Go "gccgo not supported" - Fix in CI
gccgo is an alternate Go frontend in GCC that lags the gc toolchain and lacks some features and flags. A build that depends on gc-only behavior fails when GCCGO or a gccgo toolchain is in play.
What this error means
A build fails referencing gccgo, or a gc-only flag is rejected because the runner resolved go to gccgo. The standard gc toolchain was not the one invoked.
go build: gccgo does not support "-buildmode=plugin"Common causes
gccgo on PATH instead of gc go
The runner resolved go to a gccgo-based toolchain that lacks gc-only features.
GCCGO/compiler env forcing gccgo
An environment setting selected the gccgo compiler for the build.
How to fix it
Use the official gc toolchain
- Install Go via setup-go so the gc go binary is first on PATH.
- uses: actions/setup-go@v5
with:
go-version: '1.22'Confirm which toolchain is active
- Print the version to confirm gc, not gccgo, is selected.
go version # expect: go version go1.22.x ...How to prevent it
- Install Go via setup-go so the gc toolchain wins on PATH.
- Avoid relying on a system gccgo for builds.
- Verify go version at the top of the job.