build: adopt Turborepo's experimental Go workspace support - #42
Open
PunGrumpy wants to merge 7 commits into
Open
build: adopt Turborepo's experimental Go workspace support#42PunGrumpy wants to merge 7 commits into
PunGrumpy wants to merge 7 commits into
Conversation
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 detectedLatest commit: df78db0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen 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 |
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
This reverts commit b89d6af.
This reverts commit 955aaaa.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Turborepo can now read
go.workdirectly and treat its members aspackages, so the Go modules no longer need
package.jsonwrappers tojoin the task graph.
futureFlags.experimentalGoWorkspaces, which turnsapps/apiandpackages/coreinto packages named by module path andderives their dependency edge from the
go.modrequire.apps/api/package.jsonandapps/api/turbo.json; thehand-written
$TURBO_ROOT$inputs that kept the API's cache honestare now inferred from the module graph. Trim
packages/core/package.jsonto the manifest changesets needs.checkruns
lint(go vet) andfixrunsformat, replacing theper-package
check/fixtasks that no longer have implementors.gotoolchain'sformatcommand withgofmt -l -w ..The synthesized
go fmt ./apps/api/... ./packages/core/...fails at aworkspace root because
go fmtdoes not accept cross-module patternsin workspace mode.
bin/**from the build outputs: the API binary is nowapps/api/dist/api, anddevusesgo 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