What is Go?

Knowledge Videos

Short animated explainers, organised by subject.

What is Go?

Go is a compiled language: the compiler turns main.go into a program and checks it before it runs. go run, go build, and the three parts of a first program.

Transcript

Go is a programming language made at Google. You write it as text in a file, like main dot go, and a program called the compiler turns that text into a program the computer can run.

That is the big difference from JavaScript. The browser reads JavaScript while it runs. Go is compiled first: the compiler checks the whole program, and only then it runs.

The command go run compiles and runs your program in one step. The command go build makes a program file that you can keep and run again.

A first Go program has three parts: package main, an import of fmt, and a function called main, where the program starts. Println prints a line of text.

The compiler also finds mistakes before the program runs. If you leave a variable unused, it tells you the file and the line.

Remember: Go is a compiled language. The compiler turns your text into a program, go run does it in one step, and the compiler finds mistakes before your program runs.

More in this series