Skip to content

Commit 207f456

Browse files
committed
go/internal/gcimporter: bump version number in skew check
This constant controls the "version skew" warning printed in case of panic, but doesn't control the version that is actually accepted, which is currently v2. Also, clarify meaning of 'path' parameter. The subtle difference between "package path" (linker symbol prefix, which may have "vendor/" prefix) and "import path" (string literal appearing in import declaration, sans "vendor/") is a pervasive source of bugs in gopls' handling of vendored packages. Change-Id: I8c3001a23b84abb1f18d861e01334bb3f0a5c27a Reviewed-on: https://go-review.googlesource.com/c/tools/+/444537 gopls-CI: kokoro <[email protected]> Run-TryBot: Alan Donovan <[email protected]> Reviewed-by: Matthew Dempsky <[email protected]> Auto-Submit: Alan Donovan <[email protected]> TryBot-Result: Gopher Robot <[email protected]>
1 parent 65196ca commit 207f456

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

go/gcexportdata/gcexportdata.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,11 @@ func NewReader(r io.Reader) (io.Reader, error) {
8787

8888
// Read reads export data from in, decodes it, and returns type
8989
// information for the package.
90-
// The package name is specified by path.
90+
//
91+
// The package path (effectively its linker symbol prefix) is
92+
// specified by path, since unlike the package name, this information
93+
// may not be recorded in the export data.
94+
//
9195
// File position information is added to fset.
9296
//
9397
// Read may inspect and add to the imports map to ensure that references

go/internal/gcimporter/iimport.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ const (
5151
iexportVersionPosCol = 1
5252
iexportVersionGo1_18 = 2
5353
iexportVersionGenerics = 2
54+
55+
iexportVersionCurrent = 2
5456
)
5557

5658
type ident struct {
@@ -96,7 +98,7 @@ func IImportBundle(fset *token.FileSet, imports map[string]*types.Package, data
9698
}
9799

98100
func iimportCommon(fset *token.FileSet, imports map[string]*types.Package, data []byte, bundle bool, path string) (pkgs []*types.Package, err error) {
99-
const currentVersion = 1
101+
const currentVersion = iexportVersionCurrent
100102
version := int64(-1)
101103
if !debug {
102104
defer func() {

0 commit comments

Comments
 (0)