modtidy

command
v0.130.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2026 License: BSD-3-Clause Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Command modtidy refuses a push from a clone where one of the go.mod files is not tidy, however deep it sits.

⛔ `go mod tidy` AT THE ROOT DOES NOT DESCEND INTO A DIRECTORY THAT HAS ITS OWN go.mod. Three recorded occurrences (memory a-repository-can-hold-two-modules): go-widgets/toolkit twice (the rougelex/ sub-module), and go-numerics/integrate#34 on 2026-11-14 (bench/ is its own module). Each time the root was tidied and tested, green, and the CI went red with "updates to go.mod needed". The note existed; re-reading it was not part of the gesture, so the check runs instead.

Every go.mod under the directory is checked with `go mod tidy -diff`, GOTOOLCHAIN=local and GOWORK=off: the CI's constraint. With the default GOTOOLCHAIN=auto a local run fetches whatever toolchain the directive asks for and hides the problem; a go.work file would let a sibling module satisfy a requirement the CI does not see.

⛔ A MODULE THAT COULD NOT BE READ IS NEVER REPORTED CLEAN. The command failing for any reason other than "there is a diff" (a missing toolchain, a broken go.mod, no network) is UNREAD, and UNREAD outranks untidy.

⛔⛔ AND A NON-VERDICT IS NAMED, NEVER GUESSED. Two of them exist, both measured on 2026-11-15:

  1. A module with NO GO SOURCE. `go mod tidy` can then only REMOVE requirements, so its verdict carries no information -- and the remedy it prescribes destroys the repository. go-fft/docs is a Hugo site whose only requirement is a theme; tidying it deletes the theme from go.mod AND go.sum, and the hook's own text told the next session to commit that (#294). Such a module is `skipped`, with the reason named. The Hugo config is reported, never what decides: that site has no [module] block, so a rule keyed on one would miss the occurrence it was written for. And the tools-file trick the landings use CANNOT be applied -- a Hugo theme carries a go.mod but no Go package, so no import can hold it.
  2. A DIRECTIVE FLOOR ABOVE THE LOCAL TOOLCHAIN. GOTOOLCHAIN=local on a host whose installed Go is older than a module's `go` line cannot build it at all, and in the hook UNREAD means allow -- so the gate went silently off for every repository Renovate raised to go 1.27.4, this one included (#300). The check retries once with the toolchain the directive NAMES.

Exit status: 0 every module is tidy, 1 a module is untidy, 2 a module could not be read (or no module was found). A skipped module is none of those: it is printed, counted, and does not decide the status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL