-
Book Overview & Buying
-
Table Of Contents
Mastering Go - Third Edition
By :
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 you 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.
This chapter is all about the basic data types of Go and the data structures that allow you to group data of the same data type. But let us begin with something more practical: imagine that you want to read data as command-line arguments of a utility. How can you be sure that what you have read was what you expected? How can you handle error situations? What about reading not just numbers and strings but dates and times from the command line? Do you have to write your own parser for working with dates and times?
This chapter will answer all these questions and many more by implementing the following three utilities:
This chapter covers:
error data typeWe begin this chapter with the error data type, because errors play a key role in Go.