Go - Basic Types
Boolean Type
go
bool // true or false
String Type
go
string // A sequence of Unicode characters
Numeric Types
go
// 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
go
byte // Alias for uint8
rune // Alias for int32 (represents a Unicode code point)
error // An interface type for error values