A Quick Introduction to Go
Despite its name, this chapter is more than just a quick introduction to Go, as it is also going to be the foundation for the rest of the book. The basics of Go, some design decisions, and the philosophy of Go are explained in this chapter so that you can get the big picture before learning the details of Go. Among other things, we present the advantages and disadvantages of Go so that you know when to use Go and when to consider other alternatives.
In the sections that follow, we cover a number of concepts and utilities in order to build a solid foundation of Go, before building a simplified version of the which(1)
utility, which is a UNIX utility that locates program files by searching the directories of the PATH
environment variable. Additionally, we explain how to write information in log files, as this can help you store error messages and warnings while you are developing software in Go.
At the end of the chapter, we develop a basic command line utility that computes basic statistical properties. It is that command line utility that we are going to improve and expand in the remaining book chapters as we learn more advanced Go features.
The contents of this chapter are:
- Introducing Go
- When to use Go
- Hello World!
- Running Go code
- What you should know about Go
- Developing the
which(1)
utility in Go - Logging information
- Developing a statistics application