go.mod is untidy: golang.org/x/sync listed both direct and indirect, so script/bootstrap mutates a tracked file #132
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Surfaced while implementing #117, where the implementer noticed
script/bootstraprewritinggo.modand correctly reverted it rather than carrying an unrelated change. The underlying cause is more specific than "bootstrap mutates the tree".The actual defect
go.modonmainlists the same module twice:It is genuinely a direct dependency —
internal/portcheck/portcheck.go:15importsgolang.org/x/sync/errgroup. So the// indirectentry is redundant and stale, andgo mod tidywould collapse it.REPO_POLICIES.mdis explicit: "Always rungo mod tidybefore committing." That did not happen for whichever commit introduced this.Why it is worth fixing rather than ignoring
script/bootstrapends withgo mod download, which updates the main module's requirements and therefore drops the redundant line as a side effect. Consequences:script/bootstrapon a clean checkout leavesgit statusdirty. Every agent on this repo runs bootstrap in a fresh worktree, so every one of them starts against a modified tracked file.go.modchange they did not make and cannot explain, or waste time investigating a diff that is not theirs.go.modis a dependency manifest, and one that does not survive a no-op tooling run is not in a settled state.This is not a security issue — the module hash is in
go.sumeither way, so the pinning rule is satisfied.Definition of done
go.modis tidy: rungo mod tidyand commit the result. Expect the redundantgolang.org/x/sync v0.19.0 // indirectline to disappear and the direct requirement at line 16 to remain.go.sumis consistent afterwards.git status --porcelainempty, runscript/bootstrap, confirmgit status --porcelainis still empty. Run it a second time and confirm the same. This is the check that fails today, so it is a real test rather than a formality.make checkgreen;TODO.mdupdated in the same commit.go mod tidydropping something still imported would break the build, so checkmake buildsucceeds and the import ininternal/portcheck/portcheck.gostill resolves.Commit title ends with
(closes #N).Constraints
golang.org/x/syncstays atv0.19.0; nothing else moves. Ifgo mod tidywants to change a version, stop and report rather than committing it..golangci.yml(sha256021cc83f4e6fc7c31b95b34b846723dfcf20b66b7baeea1dc40406e643346bcb) or the golangci-lint pin.go mod downloadfromscript/bootstrap— bootstrap should download dependencies. The manifest is what is wrong.maketargets andscript/entrypoints only.go mod tidyis the exception and is expected here — the policy names it directly.Environment hazards
parallel golangci-lint is running, or names any path beginning with../, or any absolute path outside your worktree. Fix is in unmerged PR #128; isolate manually meanwhile.make hooksfails in a linked worktree (#129).Sequencing
Independent of the open PRs — touches
go.mod/go.sumonly, which none of #97, #112, #113, #118, #122, #128 or #131 modifies. OnlyTODO.mdwill conflict.