Understanding the Go Build Process
Let's take a look at building Go programs.
We'll cover the following...
We will discuss Go’s tooling philosophy, understand the Go build process, and examine the go build
command.
Overview
Go prides itself on its tooling. Unlike many programming languages where the tooling is an afterthought or even left for the community, Go considers the tooling a big part of what the language offers. Modern Go builds packages and manages dependencies using modules. The old school GOPATH is still supported for backwards compatibility, but unless you maintain a legacy system and can’t move forward, you should solely focus on Go modules.
The primary tool is the go build
command that lets us also embed information when linking the program. go build
invokes the linker by default.
Multi-git can take advantage of this capability and print useful versioning information.
Understanding the Go build process
Go builds packages. These packages can be executables, static packages, or dynamic packages. When you create an executable by building a program with a main package the resulting binary ...