Skip to content

fix(build): compile the cmd package, not just main.go - #198

Merged
kardolus merged 1 commit into
mainfrom
fix/build-package-not-mainfile
Jul 31, 2026
Merged

kardolus merged 1 commit into
mainfrom
fix/build-package-not-mainfile

Conversation

@kardolus

Copy link
Copy Markdown
Owner

Problem

make reinstall (and make install) broke after main.go was split into sibling files (run.go/flags.go/config.go in #195):

cmd/chatgpt/main.go:128:18: undefined: run
cmd/chatgpt/main.go:133:2: undefined: setCustomHelp
cmd/chatgpt/main.go:134:2: undefined: setupFlags
cmd/chatgpt/main.go:142:16: undefined: initConfig

The install/release scripts compiled a single file (go build ... -a cmd/$b/main.go), so once main.go's functions moved into sibling files in the same package, that build no longer sees them.

Fix

Build the whole package (./cmd/$b) instead — matching how the Homebrew formula already builds (./cmd/chatgpt). Touches install.sh (make reinstall/install), binaries.sh (the release path — would also have failed), and install.ps1.

Why CI missed it

make unit / make integration use go test ./..., which builds packages, so they stayed green. Only the single-file install/release path was affected. Verified make reinstall builds + runs (--version OK) and a cross-compile target builds via the package form.

The install/release build scripts compiled a single file (`cmd/$b/main.go`),
which broke after main.go was split into sibling files (run.go/flags.go/
config.go): `make reinstall` failed with `undefined: run`, `undefined:
setupFlags`, etc.

Build the whole package (`./cmd/$b`) instead, matching how the Homebrew
formula already builds (`./cmd/chatgpt`). Fixes install.sh (make reinstall/
install), binaries.sh (the release path — would also have failed), and
install.ps1.

CI didn't catch this because `go test ./...` builds packages; only the
single-file install/release path was affected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@kardolus
kardolus merged commit 08834f7 into main Jul 31, 2026
9 checks passed
@kardolus
kardolus deleted the fix/build-package-not-mainfile branch July 31, 2026 11:07
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