This is the multi-page printable view of this section. Click here to print.

Return to the regular view of this page.

Go mod version

1 - go-mod-version Specification

Keep tracked go.mod files on the Go version configured for tools/go_mod.

Sources: tool README, tool BUILD, and archive.

The repository SHALL provide a tools/go_mod command that discovers every tracked go.mod file and sets its go directive to the version configured in the tool’s BUILD file. The command MUST offer an update mode and a check mode.

  • WHEN a user runs the update target
  • THEN every tracked go.mod file whose go directive differs from the configured version is rewritten to that version
  • AND files already on the configured version remain unchanged
  • WHEN the check test runs
  • THEN it fails if any tracked go.mod file has a go directive different from the configured version
  • AND it passes when every tracked go.mod file matches

The go.mod version check MUST run as part of //:repo_quality_test so a version mismatch fails repository quality.

  • WHEN a go.mod file’s go directive differs from the configured version
  • THEN //:repo_quality_test fails