What Go is and how it works
Go (often called Golang) is a compiled programming language with static typing, a garbage collector and built-in concurrency. A program is compiled to machine code in advance and needs neither an interpreter nor a virtual machine to run.
Go was created for network servers and is at its strongest in cloud infrastructure: Docker and Kubernetes, for example, are written in it. Builds are meant to be fast: even a large program should compile in a few seconds. Goroutines are so cheap that hundreds of thousands of them run in a single process. If you are used to classes with inheritance and to exceptions, you will have to adjust: Go has no type hierarchies, and errors are returned as ordinary values.
The build model is simple. A package is a directory with .go files, and a module is a set of packages with a go.mod file. The go build command compiles packages and links them into a single executable file, statically by default. That file includes the runtime — a library present in every Go program: it schedules goroutines, manages their stacks and collects garbage. The finished file is copied to a machine with the same OS and processor architecture, while a different platform is set with the GOOS and GOARCH variables.
GOOS and GOARCH variables, for example GOOS=linux GOARCH=arm64.The language and the standard library are covered by the Go 1 compatibility promise: a program that works now will keep building with new releases without changes to the source code. You still need to rebuild it, though — compatibility is guaranteed at the source level, not for binaries.
How it differs from Python and Java
| Feature | Go | Python | Java |
|---|---|---|---|
| How it runs | the compiler produces machine code in advance | an interpreter runs the program without a separate build | the compiler turns the code into bytecode, which the JVM runs |
| Typing | static: types are checked by the compiler | variables and arguments are not declared | strictly static |
| Concurrency | goroutines and channels are built into the language | threads; in a standard CPython build one thread executes the bytecode at any moment (GIL) | threads |
| What you deploy | one executable file | source code and an interpreter | bytecode and the JVM |
Choose Go for network services and tools that need to build fast and deploy as a single file. Python is more convenient for scripts and experiments in the interpreter, Java — when the team and libraries already live on the JVM. Packaging a service into an image is covered in the Docker reference, gRPC services in the gRPC reference.
What to know in advance
- Command line: directories, environment variables,
PATH— the Linux reference. - Git: the module path usually matches the repository address — the Git reference.
- HTTP basics for network services — the “HTTP and REST” reference.
Section sources
the section is written from these pages- Frequently Asked Questions (FAQ)go.dev/doc/faq(opens in a new tab)
- Command go: Environment variablespkg.go.dev/cmd/go(opens in a new tab)
- The Python Tutorial: Whetting Your Appetitedocs.python.org/3.15/tutorial/appetite.html(opens in a new tab)
- Glossary: global interpreter lockdocs.python.org/3.15/glossary.html(opens in a new tab)
- The Java Language Specification: Introductiondocs.oracle.com/javase/specs/jls/se25/html/jls-1.html(opens in a new tab)