You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set up goreleaser configuration for cross-platform compilation and distribution of the Go edition binary.
Parent Epic
Part of #488 — Go Edition: Full Feature Parity Implementation
Motivation
The Go edition's key advantage is single-binary distribution. This issue sets up goreleaser to produce platform binaries for every supported OS/architecture, with both tfenv and terraform entry points in each archive, plus Homebrew tap, .deb, .rpm, and .zip artifacts.
Clean-Room Constraint
This is a clean-room implementation. Contributors MUST NOT read, reference, copy, or adapt source code from tofuutils/tenv, hashicorp/hc-install, or any other third-party tfenv-like tool. The sole reference is tfenv's own Bash source code, documentation, and test suite.
Proposed Design
goreleaser Configuration
.goreleaser.yml at the repository root (or go/.goreleaser.yml):
terraform (or terraform.exe) — hardlink/copy of the same binary
README.md and LICENSE
Package formats:
.tar.gz for Linux and macOS
.zip for Windows
.deb and .rpm for Linux package managers
Homebrew tap: Generate Homebrew formula for tfutils/homebrew-tap
Checksums: SHA256 checksums file for all artifacts
Post-Build Hook
A post-build hook or custom publisher that creates the terraform hardlink/copy alongside tfenv in each archive. goreleaser's extra_files or a custom hook script handles this.
CGo
CGo is disabled (CGO_ENABLED=0) for all builds to ensure static binaries with no system library dependencies.
Acceptance Criteria
goreleaser config exists and is valid (goreleaser check)
goreleaser build --snapshot produces binaries for all target platforms
Each archive contains both tfenv and terraform entry points
Version, commit, and date are embedded in the binary via ldflags
Linux archives are .tar.gz, Windows archives are .zip
.deb and .rpm packages are generated for Linux
Homebrew formula is generated
SHA256 checksums file is generated
All binaries are statically linked (CGO_ENABLED=0)
goreleaser release --snapshot --skip=publish completes without errors
Binary size is reasonable (target: under 20MB per platform)
Should be implemented after all commands are functional
Implementation Notes
goreleaser v2 is the current version — use the latest stable
The terraform entry point in archives can be created via goreleaser's extra_files with a post-hook that creates hardlinks, or via a custom script
On Windows, the terraform.exe copy must be a full copy (not symlink) to avoid privilege issues
Consider signing binaries (the ADR mentions Cosign as a future capability — not required now but the goreleaser config should be structured to make it easy to add)
The Homebrew formula should install both tfenv and terraform binaries
Summary
Set up goreleaser configuration for cross-platform compilation and distribution of the Go edition binary.
Parent Epic
Part of #488 — Go Edition: Full Feature Parity Implementation
Motivation
The Go edition's key advantage is single-binary distribution. This issue sets up goreleaser to produce platform binaries for every supported OS/architecture, with both
tfenvandterraformentry points in each archive, plus Homebrew tap,.deb,.rpm, and.zipartifacts.Clean-Room Constraint
This is a clean-room implementation. Contributors MUST NOT read, reference, copy, or adapt source code from
tofuutils/tenv,hashicorp/hc-install, or any other third-party tfenv-like tool. The sole reference is tfenv's own Bash source code, documentation, and test suite.Proposed Design
goreleaser Configuration
.goreleaser.ymlat the repository root (orgo/.goreleaser.yml):Build targets:
Binary name:
tfenvldflags:
-s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}}Archives: Each archive contains:
tfenv(ortfenv.exe) — the main binaryterraform(orterraform.exe) — hardlink/copy of the same binaryREADME.mdandLICENSEPackage formats:
.tar.gzfor Linux and macOS.zipfor Windows.deband.rpmfor Linux package managersHomebrew tap: Generate Homebrew formula for
tfutils/homebrew-tapChecksums: SHA256 checksums file for all artifacts
Post-Build Hook
A post-build hook or custom publisher that creates the
terraformhardlink/copy alongsidetfenvin each archive. goreleaser'sextra_filesor a custom hook script handles this.CGo
CGo is disabled (
CGO_ENABLED=0) for all builds to ensure static binaries with no system library dependencies.Acceptance Criteria
goreleaser check)goreleaser build --snapshotproduces binaries for all target platformstfenvandterraformentry points.tar.gz, Windows archives are.zip.deband.rpmpackages are generated for Linuxgoreleaser release --snapshot --skip=publishcompletes without errorsDependencies
Implementation Notes
terraformentry point in archives can be created via goreleaser'sextra_fileswith a post-hook that creates hardlinks, or via a custom scriptterraform.execopy must be a full copy (not symlink) to avoid privilege issuestfenvandterraformbinariesLabels
type:feature,priority:high,complexity:medium,category:platform