TExcelTAD
Home › Go › Go Intro

Go Introduction

Go (often called Golang because of its old website, golang.org) is an open-source programming language created at Google in 2007 by Robert Griesemer, Rob Pike and Ken Thompson, and released publicly in 2009. It was designed to fix a very practical problem: large codebases written in C++ and Java were slow to compile and hard to keep simple. Go's answer is a small language with a fast compiler, a garbage collector and first-class support for concurrency.

What is Go used for?

  • Web servers, REST and gRPC APIs, and other back-end services
  • Cloud and infrastructure tools — Docker, Kubernetes, Terraform and Prometheus are all written in Go
  • Command-line programs that ship as a single binary with no dependencies
  • Networking software: proxies, load balancers, DNS servers
  • Data pipelines and background workers that do many things at once

Why learn Go?

Feature What it means for you
Small language Only 25 keywords — you can learn the whole syntax in days
Compiled Programs compile in seconds to a native executable
Garbage collected No manual memory management, but still fast
Goroutines and channels Running thousands of tasks at the same time is easy and cheap
Batteries included A rich standard library: HTTP, JSON, testing, crypto, and more
One code style The gofmt tool formats every Go program the same way

Go deliberately leaves features out. There are no classes, no inheritance, no exceptions and (until recently) no generics. Instead you get structs, interfaces, multiple return values for errors, and goroutines. The result is code that is easy to read — even code written by someone else.

Your first Go program

Every runnable Go program belongs to the package main and starts in a function called main. Press ▶ Run to compile and run it, then change the text and run it again.

go · try it yourself
package main

import "fmt"

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

Let's read it line by line:

  1. package main says this file belongs to the main package — the package that produces an executable program.
  2. import "fmt" loads the fmt (format) package from the standard library. It contains the printing functions.
  3. func main() { ... } declares the function where the program starts.
  4. fmt.Println(...) prints its arguments followed by a newline.

Tip: In every playground on ExcelTAD you can edit the code and press Ctrl+Enter to run it. The examples run on a real Go 1.25 compiler.

Printing several lines

Each call to fmt.Println prints one line. Statements run from top to bottom.

go · try it yourself
package main

import "fmt"

func main() {
	fmt.Println("Go is simple.")
	fmt.Println("Go is fast.")
	fmt.Println("Go makes concurrency easy!")
}
Go is simple.
Go is fast.
Go makes concurrency easy!

Go is strict (in a helpful way)

The Go compiler refuses to build a program that imports a package it never uses, or that declares a local variable it never reads. This keeps code clean. Try it: the program below imports strings but never uses it.

go · try it yourself
package main

import (
	"fmt"
	"strings"
)

func main() {
	fmt.Println("Unused imports are errors in Go")
}
# command-line-arguments
./example.go:5:2: "strings" imported and not used

Delete the "strings" line and run it again — now it compiles.

Go compared with other languages

Go Python Java Rust
Typing static dynamic static static
Runs as native binary interpreted JVM bytecode native binary
Memory garbage collector garbage collector garbage collector ownership
Concurrency goroutines threads/async threads threads/async

Test yourself

Which package must an executable Go program belong to?

  1. package app
  2. package main
  3. package go
  4. package start

What happens if you import a package and never use it?

  1. Nothing, it is ignored
  2. A warning is printed
  3. The program does not compile
  4. The package is removed automatically at run time

Which package provides Println?

  1. io
  2. os
  3. fmt
  4. print