Skip to content

Commit 65860f7

Browse files
committed
document the go.work and root replace resolution model
1 parent 819e2ac commit 65860f7

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

go.mod

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,10 @@ require (
245245
sigs.k8s.io/yaml v1.6.0 // indirect
246246
)
247247

248-
// Local resolution so the root module builds core without go.work (e.g. GOWORK=off).
249-
// go.work covers workspace dev; this covers the rest.
248+
// The root module (examples/ and test/) imports core/v2, which is not published
249+
// yet. go.work resolves it for workspace builds, but `go mod tidy` (the CI tidy
250+
// check) and any GOWORK=off build ignore go.work, so this replace is what lets
251+
// them find core locally. Dev-only: the root module is not published in v2
252+
// (consumers import the submodules directly), and this replace is never part of
253+
// a release tag. As more tiers split out, the root gains one replace per submodule.
250254
replace github.com/gruntwork-io/terratest/modules/core/v2 => ./modules/core

go.work

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
go 1.26.0
22

3+
// Development workspace. Resolves the local /v2 submodules for `go build` and
4+
// `go test` so they see each other's uncommitted code without publishing anything
5+
// or adding per-module `replace` directives, which keeps the submodule go.mod
6+
// files clean. As more tiers split out, each adds a `use ./modules/<name>` line.
7+
//
8+
// Not used at release: tags are cut with GOWORK=off and no replaces, and the
9+
// published modules resolve each other by version from the proxy. See
10+
// scripts/check-release-mode.sh, which validates that GOWORK=off build.
311
use (
412
.
513
./modules/core

0 commit comments

Comments
 (0)