Go’s built-in types are predeclared and available in all packages without import. These types form the foundation of Go’s type system.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/golang/go/llms.txt
Use this file to discover all available pages before exploring further.
Boolean Type
bool
The set of boolean values.Boolean type with two possible values:
true and false.Numeric Types
Integer Types
Go provides signed and unsigned integer types in various sizes.- Signed integers
- Unsigned integers
Signed 8-bit integer.Range: -128 to 127
Signed 16-bit integer.Range: -32,768 to 32,767
Signed 32-bit integer.Range: -2,147,483,648 to 2,147,483,647
Signed 64-bit integer.Range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
Platform-dependent signed integer type, at least 32 bits.Size: 32 bits on 32-bit systems, 64 bits on 64-bit systems
int and uint are distinct types from their sized variants (e.g., int is not an alias for int32 or int64).Floating-Point Types
IEEE 754 32-bit floating-point number.Precision: ~6-7 decimal digits
IEEE 754 64-bit floating-point number.Precision: ~15-16 decimal digits
Complex Types
Complex number with float32 real and imaginary parts.
Complex number with float64 real and imaginary parts.
String Type
string
Immutable sequence of bytes, conventionally UTF-8 encoded text.Sequence of 8-bit bytes. May be empty but never nil. Values are immutable.
Type Aliases
byte
Alias foruint8. Used to distinguish byte values from 8-bit integers.
Equivalent to
uint8 in all ways. Used by convention for raw binary data.rune
Alias forint32. Used to distinguish character values from integers.
Equivalent to
int32 in all ways. Represents a Unicode code point.Use
rune when working with Unicode characters. Use byte when working with binary data or ASCII.any
Alias forinterface{}. Represents any type.
Equivalent to
interface{} in all ways. Can hold values of any type.Special Types
comparable
Interface implemented by all comparable types.Constraint for types that support
== and != operators.Can only be used as a type parameter constraint, not as a variable type.Comparable types include booleans, numbers, strings, pointers, channels, arrays of comparable types, and structs whose fields are all comparable.
error
Conventional interface for representing errors.Interface with a single
Error() string method.The nil value represents no error.Documentation Types
These types appear in the builtin package for documentation purposes only.Type
Type
Stand-in for any Go type in function signatures. Represents the same type within a function invocation.Not a real type; used only in documentation.
Type1
Type1
Stand-in for a second distinct Go type in function signatures.Not a real type; used only in documentation.
TypeOrExpr
TypeOrExpr
Stand-in for either a Go type or an expression in function signatures.Not a real type; used only in documentation.
IntegerType
IntegerType
Stand-in for any integer type: int, uint, int8, int16, int32, int64, uint8, uint16, uint32, uint64, uintptr.Not a real type; used only in documentation.
FloatType
FloatType
Stand-in for either float32 or float64.Not a real type; used only in documentation.
ComplexType
ComplexType
Stand-in for either complex64 or complex128.Not a real type; used only in documentation.