Problem
The go-mod-tidy pre-commit hook runs go mod tidy, then checks if go.mod or go.sum differ from the staged version. On a fresh repo (or any time make fmt is run outside a git commit context), it reports a spurious failure:
go.mod or go.sum differs, please re-add it to your commit
This resolves itself once the files are git added, but is confusing when running make fmt standalone as a quality check — it gives the impression something is broken when it is not.
Suggestion
Document this behaviour clearly, or adjust the hook to only fail when there is actually a staged version to compare against (i.e. only in a true commit context).
Problem
The
go-mod-tidypre-commit hook runsgo mod tidy, then checks ifgo.modorgo.sumdiffer from the staged version. On a fresh repo (or any timemake fmtis run outside agit commitcontext), it reports a spurious failure:This resolves itself once the files are
git added, but is confusing when runningmake fmtstandalone as a quality check — it gives the impression something is broken when it is not.Suggestion
Document this behaviour clearly, or adjust the hook to only fail when there is actually a staged version to compare against (i.e. only in a true commit context).