Installing Go and Writing Our First Program

Learning objectives

In this lesson, we will write our first program, called “Hello, World!” This program, which prints the message “Hello, World!” to the console, is the classic start to any programming course. This program may seem simple, but it represents a significant first step in our journey to learn how to program in Go.

Setup

Before writing our first program, you will need to perform two tasks:

  1. Download and install the Go programming language at https://go.dev/doc/install.
  2. Download and install a text editor. We suggest the integrated development environment Visual Studio Code, which can be downloaded from https://code.visualstudio.com.

Code along video

The following video assumes that you have completed the above two tasks. We show how to establish your Go working directory and how to point VS Code at this directory. We then install the Go extension for VS Code, which will provide stylistic feedback on our code and even provide suggested autofills. Finally, we write our “Hello, World!” program, and we show how to compile and run this program.

Although we strongly suggest completing the code along on your own, you can find completed code from the code along in our course code repository.


Congratulations on building your first program! You are now ready to start learning the basics of Go.

Page Contents
Scroll to Top