Skip to content

fix: build the acor package, not main.go alone, in the release - #247

Merged
skyoo2003 merged 1 commit into
mainfrom
fix/goreleaser-builds-package
Sep 6, 2026
Merged

skyoo2003 merged 1 commit into
mainfrom
fix/goreleaser-builds-package

Conversation

@skyoo2003

Copy link
Copy Markdown
Owner

Pull Request

Description

The v1.6.0 tag build failed after every CI gate passed:

cmd/acor/main.go:224:10: undefined: dispatchDictionary

.goreleaser.yaml set builds[].main to cmd/acor/main.go — a file, not a package. Go compiles a file path as the pseudo-package command-line-arguments and excludes its siblings, so the release binary was built from main.go alone.

That worked by accident. Until #244, cmd/acor held only main.go and main_test.go, and test files are excluded from a build anyway. #244 added cmd/acor/dictionary.go, which defines dispatchDictionary, and main.go:224 calls it — so the single-file build stopped compiling the moment that PR merged, and nothing said so until a tag was pushed.

No existing gate could have caught this, which is the part worth fixing rather than just patching:

Build Command Result
make build, CI, pre-commit go build ./cmd/acor (package) passes
GoReleaser go build cmd/acor/main.go (file) fails

The two builds compiled different things, so a green main proved nothing about the release. Naming the package collapses them into one build — make build now genuinely gates the release path.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactoring (no functional changes)
  • Test update

Checklist

  • Tests pass (make test) — no Go files changed; pre-commit skipped the Go hooks for that reason
  • Vet/make vet — same
  • Linting passes (make lint) — same
  • Build succeeds (make build) — same, and verified directly below
  • Documentation updated if needed — N/A
  • Changelog fragment added (changie new) — deliberately skipped: release-infrastructure only, and no published release ever carried the bug. changes/v1.6.0.md is already batched and stays as written
  • Commit messages follow guidelines

Verification

$ goreleaser build --snapshot --clean --single-target
    • building     paths=cmd/acor binaries=acor target=darwin_arm64_v8.0
    • build succeeded after 6s

$ dist/.../acor --help | grep -c dictionary
1
$ dist/.../acor version
1.6.0-SNAPSHOT-7fc2e3b

paths=cmd/acor — the package. The binary carries the dictionary command that the tag build could not compile.

Additional Notes

No release artifacts were published by the failed run: the build dies before the publish step, so there is no v1.6.0 GitHub release and no GHCR image. The only thing that exists is the v1.6.0 tag.

After this merges, recovery follows RELEASE.md's rollback: delete the tag locally and remotely, re-tag the new main, and push. changes/v1.6.0.md is untouched and gets reused as-is.


By submitting this PR, I agree that my contributions will be licensed under the Apache License 2.0.

`builds[].main` named `cmd/acor/main.go`, a file rather than a package. Go
compiles a file path as `command-line-arguments` and drops its siblings in the
same package, so the release binary was built from main.go alone.

That held by accident: until #244, `cmd/acor` contained only `main.go` and
`main_test.go`. #244 added `dictionary.go`, and `main.go:224` calls
`dispatchDictionary` from it — so the v1.6.0 tag build failed with `undefined:
dispatchDictionary` after every CI gate had passed.

No gate could have caught it. `make build` and CI run `go build ./cmd/acor`,
the package; GoReleaser was compiling something else. Naming the package makes
the two builds the same build, so `make build` now gates the release path.

Verified with `goreleaser build --snapshot --single-target`: builds
`paths=cmd/acor`, and the binary's `--help` lists `dictionary`.
@skyoo2003
skyoo2003 merged commit fc14dde into main Sep 6, 2026
1 check passed
@skyoo2003
skyoo2003 deleted the fix/goreleaser-builds-package branch September 6, 2026 08:08
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.

1 participant