Go basics: what the language is and where it is used

About the Go language

Go (often also golang) is a compiled multithreaded programming language developed internally by Google.

Development of Go began in September 2007 and was directly designed by Robert Griesemer, Rob Pike, and Ken Thompson, who had previously worked on the Inferno operating system.

The language was officially introduced in November 2009. At the moment, the official compiler developed by the creators of the language is supported for OpenBSD , Linux , macOS, Windows , DragonFly BSD, Plan 9, Solaris, Android and AIX.

Go is also supported by a set of gcc compilers, and there are several independent implementations.

Online IDE : play.golang.org

Where Go is used

Go is a general-purpose language, and its standard library covers networks, files and text without extra dependencies.

Most often it is chosen for web backends, network proxies, DevOps and command line utilities, and cloud services. One codebase builds a native binary for each platform, so deployment is a single file with no runtime to install.

Go has a small and regular syntax, so beginners read real programs after a few lessons. The compiler is fast, and built-in concurrency helps a program handle many tasks at once.

Comments

Go has the same two comment forms as C and PHP: a line that starts with // runs to the end of the line, and everything between /* and */ is a comment, across several lines if needed.

package main // A one-line comment /* A comment across several lines */ func main() { }

The compiler ignores comments. The gofmt tool still formats them, so keep one space after // and align a block comment with the code around it.

Hello world

Save the program below as main.go and run it with go run main.go.

The first line declares package main, the import brings in the fmt package, and execution starts in the main function.

package main import "fmt" func main() { fmt.Println("Hello, Go") }

go run main.go

Hello, Go

The course

The Go course takes the same program as its starting point and goes on for fifty lessons: types, functions, interfaces, generics, testing, HTTP servers and clients, concurrency, and two capstone projects.

Start with lesson 1, What is Go and where it runs, and follow the chain of previous and next links at the bottom of every page.

The code on this page was run with go 1.26.10 on Alpine Linux 3.24 (x86_64) in a Docker container.

Article author: Arthur Isaev