One of Go’s greatest features is that it can be used to build statically linked cross-platform binaries. In this learning activity, you’ll go through the process of taking an existing Go application and building separate binaries for a few different Unix-based operating systems: Linux, macOS, and FreeBSD.
Learning Objectives
Successfully complete this lab by achieving the following learning objectives:
- Compile an `hr` Binary for Linux
The primary operating system that the
hr
utility will be used on is Linux. Compile a binary that can run on Linux systems like your workstation. Call this binaryhr.linux
.- Compile an `hr` Binary for macOS
Compile a binary that can run on macOS systems. Call this binary
hr.darwin
.Note: The operating system identifier is
darwin
.- Compile an `hr` Binary for FreeBSD
Compile a binary that can run on macOS systems. Call this binary
hr.freebsd
.