internal/mod/modload: skip over local module requirements in CheckTidy
A user reported that they were trying to publish a tidied module,
where the latest version of CUE made no changes via `cue mod tidy`,
yet the central registry responded with:
400 Bad Request: manifest invalid: module is not tidy
And indeed, it turns out this error came from `cue mod tidy --check`.
After a bit of digging, it seems like the cause was the module
contained packages in cue.mod/gen/ which were imported from the root
package in the module, and this causes --check to think the module's
requirements are not up to date, even though `cue mod tidy` is happy.
This makes `cue mod tidy --check` agree with `cue mod tidy`
in the case where the current module requires "local" modules
from cue.mod/*/ directories, as those are not written out
as dependencies in cue.mod/module.cue.
The added test case failed the newly added sanity check without the fix:
--- FAIL: TestTidy/testdata/tidy/cuemod-local.txtar (0.01s)
quicktest.go:22:
error:
got non-nil value
comment:
CheckTidy after a successful Tidy should not fail
got:
e"module is not tidy"
stack:
/home/mvdan/src/c/cue/internal/mod/modload/tidy_test.go:72
qt.Check(t, qt.IsNil(err), qt.Commentf("CheckTidy after a successful Tidy should not fail"))
Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Ic0575567a9bea52fdb9cc10a0450d633d190c053
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195659
Reviewed-by: Paul Jolly <paul@myitcv.io>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>