Running ./macos/build.sh from a worktree under .claude/worktrees/ fails at the Go step:
main module (github.com/maxghenis/openmessage) does not contain package
github.com/maxghenis/openmessage/.claude/worktrees/<name>
Cause
The worktree has its own valid go.mod, but Go walks up the directory tree, finds ~/openmessage/go.work, and resolves the main module to the parent checkout. go build . then treats the worktree's cwd as a subpackage path of the parent module, which doesn't exist.
It's not specific to build.sh — a bare go build . in the worktree fails identically.
Workaround
GOWORK=off ./macos/build.sh
Confirmed working; this is how #154 was verified end to end.
Suggested fix
Have build.sh set GOWORK=off for its own go build invocations, or detect the situation and fail with an actionable message rather than Go's confusing package-path error. Note docs/agent-runbook.md already has a separate go.work gotcha (an untracked use ../tmp/whatsmeow silently overriding the whatsmeow pin), so go.work has now bitten builds twice in different ways — worth handling deliberately rather than per-incident.
Documented as a workaround in CLAUDE.md and the runbook via #154, but the script should just handle it.
Running
./macos/build.shfrom a worktree under.claude/worktrees/fails at the Go step:Cause
The worktree has its own valid
go.mod, but Go walks up the directory tree, finds~/openmessage/go.work, and resolves the main module to the parent checkout.go build .then treats the worktree's cwd as a subpackage path of the parent module, which doesn't exist.It's not specific to
build.sh— a barego build .in the worktree fails identically.Workaround
Confirmed working; this is how #154 was verified end to end.
Suggested fix
Have
build.shsetGOWORK=offfor its owngo buildinvocations, or detect the situation and fail with an actionable message rather than Go's confusing package-path error. Notedocs/agent-runbook.mdalready has a separatego.workgotcha (an untrackeduse ../tmp/whatsmeowsilently overriding the whatsmeow pin), sogo.workhas now bitten builds twice in different ways — worth handling deliberately rather than per-incident.Documented as a workaround in
CLAUDE.mdand the runbook via #154, but the script should just handle it.