Back to course

Variables and Primitive Types

Go (Golang) for Cloud-Native Microservices

Variables and Types

Go is statically typed. This provides performance and safety.

Declarations:

  • var name string = "Go" (Explicit)
  • name := "Go" (Short declaration, common inside functions)

Basic Types:

  • int, float64, bool, string.
  • uint for positive integers (useful for byte offsets).

Go values are initialized to 'Zero Values' if not specified (e.g., 0 for numbers, "" for strings).