A Book of Go — 1. Getting Started with Go

Louis Petrik
2 min readMay 14, 2024
Source: the author

Welcome to this free digital book on the Go programming language!
It is divided into several topics to provide a complete overview of Go, its features, and what can be created with it.

This book tries to provide a step-by-step tutorial for complete beginners — yet it can be used by developers with existing Go experience to refresh knowledge or learn new concepts.

No long talk. Let’s dive into this amazing language!

Installing Go

Installing the Go programming language can be done here: https://go.dev/doc/install

Once you have completed the installation, type the following into your terminal, to see if Go is working:

Ideally, an output like go version go1.22.2 darwin/amd64 should appear. You are good to go!

Hello world in Go

Once your environment is set up, you’re ready to write your first Go program. Here’s how you can write the classic “Hello World”:

  1. Create a New File: Inside your directory of choice, create a new file named hello.go.
  2. Write the Code: Open hello.go in your editor and type the following Go code:
  • package main: This line defines the package name. Every Go…

--

--