Skip to content
Latchkey

go version: Usage, Options & Common CI Errors

Report the Go toolchain (or a binary’s) version.

go version prints the installed Go toolchain version. Given a binary or directory it prints the Go version each binary was built with, and with -m the embedded module build info.

What it does

With no argument, prints the running toolchain (e.g. go version go1.22.5 linux/amd64). With file arguments, reports the build version of each Go binary; -m adds the module dependency list baked into the binary.

Common usage

Terminal
go version                        # toolchain version
go version ./bin/app              # version a binary was built with
go version -m ./bin/app           # embedded module build info

Common CI error: toolchain mismatch

A build fails or behaves differently because the runner’s go version differs from what the project expects - or go.mod’s go/toolchain directive triggers an automatic toolchain download you did not anticipate. Fix: pin the version in setup-go (go-version: ‧1.22.x’), assert it in CI with go version, and keep the go directive in go.mod aligned with the installed toolchain.

Options

FormEffect
go versionPrint toolchain version
go version <file>Version of a built binary
-mShow embedded module info

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →