Chapter 2. Go Language Essentials

In the previous chapter, we established the elemental characteristics that make Go a great language with which to create modern system programs. In this chapter, we dig deeper into the language's syntax to explore its components and features.

We will cover the following topics:

  • The Go source file
  • Identifiers
  • Variables
  • Constants
  • Operators

The Go source file

We have seen, in Chapter 1, A First Step in Go, some examples of Go programs. In this section, we will examine the Go source file. Let us consider the following source code file (which prints "Hello World" greetings in different languages):

The Go source file

golang.fyi/ch02/helloworld2.go ...

Get Go: Design Patterns for Real-World Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.