golang/go

cmd/internal/moddeps: confusing error message when difference is due to a "replace" directive

Open

#44,508 opened on Feb 22, 2021

View on GitHub
 (3 comments) (0 reactions) (0 assignees)Go (19,008 forks)batch import
NeedsInvestigationTestinghelp wanted

Repository metrics

Stars
 (133,883 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

On CL 295150 Patchset 2, I suspected that the TryBots would fail due to the replace directive, but I wanted to see what would happen anyway.

TestDependencyVersionsConsistent did indeed fail as expected, but the last error in the output is very weird:

--- FAIL: TestDependencyVersionsConsistent (0.00s)
    moddeps_test.go:361: cannot check consistency for filesystem-local replacement in module cmd (/tmp/workdir/go/src/cmd):
        # golang.org/x/mod v0.4.1 => /usr/local/google/home/bcmills/x/mod
    moddeps_test.go:379: Modules within GOROOT require different versions of golang.org/x/mod.
    moddeps_test.go:391: cmd	requires v0.4.1 => /usr/local/google/home/bcmills/x/mod
    moddeps_test.go:391: cmd	requires =>

The correct reason for the failure is the one reported at line 361 (cannot check consistency for filesystem-local replacement).

However, the failure also includes an extraneous line cmd requires =>, which is quite confusing.

Contributor guide