Skip to content

Instantly share code, notes, and snippets.

@gedenata
Last active May 4, 2020 07:38
Show Gist options
  • Save gedenata/59882a0cc150fa7345af6a350f67f44d to your computer and use it in GitHub Desktop.
Save gedenata/59882a0cc150fa7345af6a350f67f44d to your computer and use it in GitHub Desktop.
Go's predeclared identifiers
data type descriptions zero-value
bool bool is the set of boolean values. It can store set of untyped boolean value `true` or `false`. false
uint8 uint8 is the set of all unsigned 8-bit integers. Range: 0 through 255. 0
uint16 uint16 is the set of all unsigned 16-bit integers. Range: 0 through 65535. 0
uint32 uint32 is the set of all unsigned 32-bit integers. Range: 0 through 4294967295. 0
uint64 uint64 is the set of all unsigned 64-bit integers. Range: 0 through 18446744073709551615. 0
int8 int8 is the set of all signed 8-bit integers. Range: -128 through 127.
int16 int16 is the set of all signed 16-bit integers. Range: -32768 through 32767. 0
int32 int32 is the set of all signed 32-bit integers. Range: -2147483648 through 2147483647. 0
int64 int64 is the set of all signed 64-bit integers. Range: -9223372036854775808 through 9223372036854775807. 0
float32 float32 is the set of all IEEE-754 32-bit floating-point numbers. Range: -3.4E+38 through +3.4E+38. 0
float64 float32 is the set of all IEEE-754 32-bit floating-point numbers. Range: -1.7E+308 through +1.7E+308. 0
complex64 complex64 is the set of all complex numbers with float32 real and imaginary parts. 0+0i
complex128 complex128 is the set of all complex numbers with float64 real and imaginary parts. 0+0i
string string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text. A string may be empty, but not nil. Values of string type are immutable empty string
int int is a signed integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, int32. Range: -2147483648 through 2147483647. 0
uint uint is an unsigned integer type that is at least 32 bits in size. It is a distinct type, however, and not an alias for, say, uint32. Range: 0 through 4294967295. 0
uintptr uintptr is an integer type that is large enough to hold the bit pattern of any pointer. 0
byte byte is an alias for uint8 and is equivalent to uint8 in all ways. It is used, by convention, to distinguish byte values from 8-bit unsigned integer values. 0
rune rune is an alias for int32 and is equivalent to int32 in all ways. It is used, by convention, to distinguish character values from integer values. 0
error error is the conventional interface for representing an error condition, with the nil value representing no error. nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment