Go CLI Cheat Sheet/Build named binary

Write the compiled binary to a specific path.

Section: Run Build Install

Build named binary

bash
bash
go build -o ./bin/app .
Explanation

Write the compiled binary to a specific path. Useful in Go CLI workflows.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Run Build Install
Build current package
Compile the current package or module target.
OpenIn sheetbashsame section
Run program
Compile and run the current module entrypoint.
OpenIn sheetbashsame section
Run single file
Compile and run a single Go source file.
OpenIn sheetbashsame section
Install package
Compile and install a package binary.
OpenIn sheetbashsame section
Install versioned tool
Install a tool at an explicit module version.
OpenIn sheetbashsame section
Help for build
Show detailed help for go build flags and behavior.
OpenIn sheetbash2 tag match