Beginner Fundamentals

Introduction

Go (also called Golang) is an open-source programming language created at Google. It is designed to be simple to read, fast to compile, and great for building reliable software, from command-line tools to large web services.

Key features

  • Compiled: source code is turned into a single native executable.
  • Statically typed: types are checked at compile time, catching many bugs early.
  • Concurrency built in: goroutines and channels make concurrent code natural.
  • Simple syntax: a small set of keywords keeps the language easy to learn.

Why learn Go

  • Fast startup and low memory usage.
  • A rich standard library.
  • Strong tooling: formatting, testing and building come out of the box.

Hello world

Every Go program starts in a package. An executable program uses package main and a main function.

package main

import "fmt"

func main() {
    fmt.Println("Hello, world!")
}

The import "fmt" line brings in the formatting package, and fmt.Println prints a line of text to the screen.