Explain Data Types in Go Programming Language | Go Programming Tutorial
In this article, you will learn the different types of data type in the Go Programming language along with the basic level example.
The data type is used to mention which type of data Golang can hold. In the Go language, the data type is divided into four categories which are as follows:
- Basic Type: Numbers, strings, and booleans fall under this category.
- Aggregate Type: Arrays and structs fall under this category.
- Reference Type: Under this category, pointers, slices, maps, functions, and channels fall.
- The interface type is also one of the data types in the Go Programming Language.
Let’s discuss the Basic Data Types in the Go programming language in depth. It is further divided into three sub-categories which are:
- Numbers
- Booleans
- Strings
Numbers:
Numbers are further divided into three subcategories in the Go Programming Language:
- Integers: The integers have both signed and unsigned integers which are available in four different sizes. We use it to represent the signed integer and uint to represent the unsigned integer.
- Floating-Point Numbers: Floating numbers are divided into two categories in the Go Programming Language.
- Complex Numbers: Complex numbers are also divided into two categories. The two categories of floating numbers are also part of the complex numbers. The in-built function creates a complex number from its imaginary and real parts.
Booleans:
The boolean data type represents only one bit of information i.e true or false. The values of the boolean data type are not converted into any other data type.
Strings:
The string data type represents an order of Unicode code points. In simple words, we can say a string is a sequence of immutable bytes. It simply means a string can not be changed once it is created.


