Introduction

Let’s get an overview of basic Go data types.

We'll cover the following

Data is stored and used in variables, and all Go variables should have a data type that is determined either implicitly or explicitly. Knowing the built-in data types of Go allows us to understand how to manipulate simple data values and construct more complex data structures when simple data types are not enough or not efficient for a given job.

Introducing data types

This chapter is all about the basic data types of Go and the data structures that allow us to group data of the same data type. But let’s begin with something more practical: imagine that we want to read data as command-line arguments of a utility. How can we be sure that what we have read was what we expected? How can we handle error situations? What about reading not just numbers and strings but dates and times from the command line? Do we have to write our own parser for working with dates and times?

Get hands-on with 1200+ tech skills courses.