Skip to content

Commit eab0c46

Browse files
author
Bryan C. Mills
committed
cmd/go/internal/modload: remove outdated comments and redundant tests
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]>
1 parent 0816511 commit eab0c46

File tree

3 files changed

+19
-45
lines changed

3 files changed

+19
-45
lines changed

src/cmd/go/internal/modload/modfile.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -501,9 +501,6 @@ func goModSummary(m module.Version) (*modFileSummary, error) {
501501
// return the full list of modules from modules.txt.
502502
readVendorList()
503503

504-
// TODO(#36876): Load the "go" version from vendor/modules.txt and store it
505-
// in rawGoVersion with the appropriate key.
506-
507504
// We don't know what versions the vendored module actually relies on,
508505
// so assume that it requires everything.
509506
summary.require = vendorList

src/cmd/go/testdata/script/mod_go_version_vendor.txt

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/cmd/go/testdata/script/mod_vendor_goversion.txt

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,40 @@ go build example.net/need117
1111
stderr '^bad114[/\\]bad114.go:15:2: duplicate method Y$'
1212

1313

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

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

31+
! grep 1.13 vendor/modules.txt
32+
go build example.net/bad114
33+
2234

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

2638
go mod edit -go=1.17
2739
go mod vendor
40+
41+
grep '^## explicit; go 1.17$' vendor/modules.txt
2842
go build example.net/need117
43+
44+
grep '^## explicit; go 1.13$' vendor/modules.txt
2945
! go build example.net/bad114
3046
stderr '^vendor[/\\]example\.net[/\\]bad114[/\\]bad114.go:15:2: duplicate method Y$'
3147

32-
3348
-- go.mod --
3449
module example.net/m
3550

0 commit comments

Comments
 (0)