Skip to content

macos/build.sh fails in a nested .claude/worktrees checkout (go.work resolves the main module to the parent) #164

Description

@MaxGhenis

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions