Skip to content

build: adopt Turborepo's experimental Go workspace support - #42

Open
PunGrumpy wants to merge 7 commits into
mainfrom
claude/turborepo-go-support-e7x6s1
Open

build: adopt Turborepo's experimental Go workspace support#42
PunGrumpy wants to merge 7 commits into
mainfrom
claude/turborepo-go-support-e7x6s1

Conversation

@PunGrumpy

Copy link
Copy Markdown
Owner

Turborepo can now read go.work directly and treat its members as
packages, so the Go modules no longer need package.json wrappers to
join the task graph.

  • Enable futureFlags.experimentalGoWorkspaces, which turns
    apps/api and packages/core into packages named by module path and
    derives their dependency edge from the go.mod require.
  • Delete apps/api/package.json and apps/api/turbo.json; the
    hand-written $TURBO_ROOT$ inputs that kept the API's cache honest
    are now inferred from the module graph. Trim
    packages/core/package.json to the manifest changesets needs.
  • Map the repo's script names onto the synthesized task names: check
    runs lint (go vet) and fix runs format, replacing the
    per-package check/fix tasks that no longer have implementors.
  • Override the go toolchain's format command with gofmt -l -w ..
    The synthesized go fmt ./apps/api/... ./packages/core/... fails at a
    workspace root because go fmt does not accept cross-module patterns
    in workspace mode.
  • Drop bin/** from the build outputs: the API binary is now
    apps/api/dist/api, and dev uses go run . instead of Air.

This requires turbo 2.10.13-canary.4 or later; the flag does not exist
in any stable release yet.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01ULAxKvHY6VD6aPxmsop4ni

Turborepo can now read `go.work` directly and treat its members as
packages, so the Go modules no longer need `package.json` wrappers to
join the task graph.

- Enable `futureFlags.experimentalGoWorkspaces`, which turns
  `apps/api` and `packages/core` into packages named by module path and
  derives their dependency edge from the `go.mod` require.
- Delete `apps/api/package.json` and `apps/api/turbo.json`; the
  hand-written `$TURBO_ROOT$` inputs that kept the API's cache honest
  are now inferred from the module graph. Trim
  `packages/core/package.json` to the manifest changesets needs.
- Map the repo's script names onto the synthesized task names: `check`
  runs `lint` (`go vet`) and `fix` runs `format`, replacing the
  per-package `check`/`fix` tasks that no longer have implementors.
- Override the `go` toolchain's `format` command with `gofmt -l -w .`.
  The synthesized `go fmt ./apps/api/... ./packages/core/...` fails at a
  workspace root because `go fmt` does not accept cross-module patterns
  in workspace mode.
- Drop `bin/**` from the build outputs: the API binary is now
  `apps/api/dist/api`, and `dev` uses `go run .` instead of Air.

This requires turbo 2.10.13-canary.4 or later; the flag does not exist
in any stable release yet.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULAxKvHY6VD6aPxmsop4ni
@changeset-bot

changeset-bot Bot commented Sep 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df78db0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Sep 11, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
pigo Ready Ready Preview Sep 11, 2026 5:58am UTC
pigo-api Ready Ready Preview Sep 11, 2026 5:58am UTC

Apply the writing guidelines review to the prose added with the Go
workspace migration.

- Replace "first-class Turborepo packages" with what it buys the reader:
  one task graph and one cache.
- Open the project structure section with a summary sentence.
- Show `--filter=./apps/api` alongside the module path; the directory
  form works and is shorter.
- Say what `go-workspace` is before using the name, and note that
  filtering to one module runs that module's own `go test ./...`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULAxKvHY6VD6aPxmsop4ni
Enabling `experimentalGoWorkspaces` makes Turborepo run `go work edit
-json` while building the package graph, before it reads `--filter`, so
every `turbo run` in the repo now needs a Go toolchain on PATH. The
Next.js build image has none, and the web deployment failed on it even
though that app never invokes Go.

Both apps now set their own `buildCommand` and skip Turborepo on Vercel:

- `apps/web`: `bun run --filter web build`. Resolves the workspace by
  walking up, so it builds from either the repo root or the app
  directory, and `.next` still lands in `apps/web`.
- `apps/api`: `go build -o "$VERCEL_OUTPUT_FILE" <module path>`. The
  synthesized task writes `dist/api`, which the platform's Go builder
  could not find; addressing the module by path rather than by `.` keeps
  the command correct from either working directory.

Turborepo still drives every local and CI task; only the two Vercel
build commands bypass it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ULAxKvHY6VD6aPxmsop4ni
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.

2 participants