Latest web development tutorials

Go language data types

In the Go programming language, data type used to declare functions and variables.

Data types appear to divide the data into different memory size required for data programming time required by large data when it needs to apply for a large memory, you can take advantage of memory.

Go Language There are several types of data by category:

No. Type and Description
1 Boolean <br> Boolean values can only be a constant true or false.A simple example: var b bool = true.
2 <br>Numeric type integer int and float float, Go language support for integer and floating point numbers, and native support for complex numbers, which bit operations using complement.
3 String type:
The character string is a string of fixed length connecting sequence of characters. Go strings are connected by a single byte. Go byte string of language use UTF-8 Unicode text encoding logo.
4 Derived type:
include:
  • (A) the type of pointer (Pointer)
  • (B) an array type
  • (C) structured type (struct)
  • (D) the type of union (union)
  • (E) the type of function
  • (F) slice type
  • (G) interface type (interface)
  • (H) Map Types
  • (I) Channel type

Digital Type

Go is also based on the type of architecture, such as: int, uint and uintptr.

No. Type and Description
1 uint8
Unsigned 8-bit integer (0-255)
2 uint16
16-bit unsigned integer (0-65535)
3 uint32
32-bit unsigned integer (0-4294967295)
4 uint64
64-bit unsigned integer (0-18446744073709551615)
5 int8
Signed 8-bit integer (-128 to 127)
6 int16
16-bit signed integer (-32768 to 32767)
7 int32
Signed 32-bit integer (-2147483648 to 2147483647)
8 int64
Signed 64-bit integer (-9223372036854775808 to 9223372036854775807)

Float:

No. Type and Description
1 float32
IEEE-754 32-bit floating point type number
2 float64
IEEE-754 64-bit floating point type number
3 complex64
32-bit real and imaginary
4 complex128
64-bit real and imaginary

Other types of digital

Here are more other numeric types:

No. Type and Description
1 byte
Similar uint8
2 rune
Similar int32
3 uint
32 or 64
4 int
And the same size as uint
5 uintptr
Unsigned int, used to store a pointer