Skip to content

Commit

Permalink
cmd/go/internal/modload: remove outdated comments and redundant tests
Browse files Browse the repository at this point in the history
The outdated comment in modfile.go was missed in CL 315409.

Upon a closer look at the test case in mod_go_version_vendor.txt, it
is almost completely redundant with the new test in
mod_vendor_goversion.txt. Make it completely redundant and remove it.

Updates #36876

Change-Id: Ibcd1f6b426460aaafbd6dc0be93078547904572b
Reviewed-on: https://go-review.googlesource.com/c/go/+/316209
Trust: Bryan C. Mills <[email protected]>
Run-TryBot: Bryan C. Mills <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Jay Conrod <[email protected]>
  • Loading branch information
Bryan C. Mills committed May 4, 2021
1 parent 0816511 commit eab0c46
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 45 deletions.
3 changes: 0 additions & 3 deletions src/cmd/go/internal/modload/modfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,9 +501,6 @@ func goModSummary(m module.Version) (*modFileSummary, error) {
// return the full list of modules from modules.txt.
readVendorList()

// TODO(#36876): Load the "go" version from vendor/modules.txt and store it
// in rawGoVersion with the appropriate key.

// We don't know what versions the vendored module actually relies on,
// so assume that it requires everything.
summary.require = vendorList
Expand Down
38 changes: 0 additions & 38 deletions src/cmd/go/testdata/script/mod_go_version_vendor.txt

This file was deleted.

23 changes: 19 additions & 4 deletions src/cmd/go/testdata/script/mod_vendor_goversion.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,40 @@ go build example.net/need117
stderr '^bad114[/\\]bad114.go:15:2: duplicate method Y$'


# With a vendor/modules.txt lacking language versions, the world is topsy-turvy.
# Things that ought to build shouldn't, and things that shouldn't build do.
# With a vendor/modules.txt lacking language versions, the world is topsy-turvy,
# because we have to guess a uniform version for everything.
#
# We always guess Go 1.16, because that was the last version for which
# 'go mod vendor' failed to record dependency versions, and it has most of
# the language features added since modules were introduced in Go 1.11.
#
# Even so, modules that declare 'go 1.17' and use 1.17 features spuriously fail
# to build, and modules that declare an older version and use features from a
# newer one spuriously build (instead of failing as they ought to).

go mod vendor
go build example.net/bad114

! grep 1.17 vendor/modules.txt
! go build example.net/need117
stderr '^vendor[/\\]example\.net[/\\]need117[/\\]need117.go:5:18: .*\n\tconversion of slices to array pointers only supported as of -lang=go1\.17'

! grep 1.13 vendor/modules.txt
go build example.net/bad114


# Upgrading the main module to 1.17 adds version annotations.
# Then everything is once again consistent with the non-vendored world.

go mod edit -go=1.17
go mod vendor

grep '^## explicit; go 1.17$' vendor/modules.txt
go build example.net/need117

grep '^## explicit; go 1.13$' vendor/modules.txt
! go build example.net/bad114
stderr '^vendor[/\\]example\.net[/\\]bad114[/\\]bad114.go:15:2: duplicate method Y$'


-- go.mod --
module example.net/m

Expand Down

0 comments on commit eab0c46

Please sign in to comment.