A blog about programming, Web development, Open Source, Linux and DevOps.

Go - Basic Types

Boolean Type

bool // true or false

String Type

string // A sequence of Unicode characters

Numeric Types

// Signed integers.
int int8 int16 int32 int64

// Unsigned integers.
uint uint8 uint16 uint32 uint64 uintptr

// Floating-point numbers.
float32 float64

// Complex numbers (Can be safely ignored if you haven't heard or used them before).
complex64 complex128

Note: When you need an integer value use int, unless you have a specific reason to use a sized or unsigned integer type.

Other Types

byte  // Alias for uint8

rune  // Alias for int32 (represents a Unicode code point)

error // An interface type for error values