Skip to content

fix(dev): replace binutils-gold with CGO_ENABLED=0 in dev images#6292

Merged
gustavosbarreto merged 1 commit into
masterfrom
fix/dev-cgo-disabled
May 8, 2026
Merged

fix(dev): replace binutils-gold with CGO_ENABLED=0 in dev images#6292
gustavosbarreto merged 1 commit into
masterfrom
fix/dev-cgo-disabled

Conversation

@gustavosbarreto

Copy link
Copy Markdown
Member

Closes #6285.

Summary

  • binutils-gold was added in feat: add device custom fields #6248 to fix cannot find 'ld' on linux/arm64 alpine when installing dev tools (air, golangci-lint, mockery).
  • The real trigger is Go's net/os/user compiling with cgo by default, not the tools themselves — they are pure Go.
  • Drop binutils-gold (and build-base where it was added only to support the cgo link step) and use CGO_ENABLED=0 inline on each go install.

CGO_ENABLED=0 is set inline only on the dev tool installs. App builds (via air, or the production builder stage) are unaffected.

Verified on linux/arm64 (emulated):

  • agent dev image builds without binutils-gold / build-base
  • air -v and golangci-lint --version run inside the arm64 image
  • go build -tags docker of the agent succeeds inside the dev image and the resulting binary runs (agent --help)

binutils-gold was added to work around 'cannot find ld' on linux/arm64
alpine when 'go install' of dev tools (air, golangci-lint, mockery)
linked via cgo. The real trigger is Go's net/os/user packages compiling
with cgo by default, not the tools themselves — they are pure Go.

Replace the workaround with CGO_ENABLED=0 inline on each go install.
This also drops build-base (gcc) where it was added only to support
the cgo link step.

gold is deprecated in binutils 2.44 (Jan 2025); Alpine will drop the
package eventually.

Closes #6285.
@gustavosbarreto gustavosbarreto requested review from a team as code owners May 8, 2026 19:34
@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Code Review

  • Gathered PR context
  • Reviewing with 5 specialized agents
  • Posting feedback

View job run

@gustavosbarreto

Copy link
Copy Markdown
Member Author

@danielgatis could you test this in your environment? You introduced binutils-gold in #6248 to fix the linux/arm64 build, so it would be good to confirm this swap to CGO_ENABLED=0 still works for you. Thanks!

@gustavosbarreto

Copy link
Copy Markdown
Member Author

/review

@github-actions

github-actions Bot commented May 8, 2026

Copy link
Copy Markdown

Claude finished @gustavosbarreto's task in 10m 47s —— View job


Code Review Complete

Reviewed 6 files across code quality, security, testing, Go patterns, and architecture — no issues found. The code looks good as-is.

The change is clean and consistent: CGO_ENABLED=0 is correctly applied as an inline env var (POSIX-correct, scoped per-command) to all dev tool installs across all 6 Dockerfiles. build-base and binutils-gold are properly removed from dev stages. Production/builder stages and air-driven app builds are unaffected. The enterprise cloud repo has no separate Dockerfiles so it benefits automatically.


To request another review round, comment /review.

@gustavosbarreto gustavosbarreto merged commit 954887f into master May 8, 2026
22 of 23 checks passed
@gustavosbarreto gustavosbarreto deleted the fix/dev-cgo-disabled branch May 8, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dev: replace deprecated binutils-gold with CGO_ENABLED=0 in dev images

1 participant