Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/vet: "unexpected kind tag" when running default 'go test' analyzers on a package that uses generics #48101

Closed
bcmills opened this issue Aug 31, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker Soon This needs to be done soon. (regressions, serious bugs, outages)
Milestone

Comments

@bcmills
Copy link
Contributor

bcmills commented Aug 31, 2021

Now that #48094 is fixed, I'm running into another issue using generics, this time via go vet and whatever cmd/vet uses to import packages.

What version of Go are you using (go version)?

~/src/github.com/bcmills/unsafeslice$ gotip version
go version devel go1.18-144e0b1f6 Tue Aug 31 17:35:15 2021 +0000 linux/amd64

Does this issue reproduce with the latest release?

N/A

What operating system and processor architecture are you using (go env)?

go env Output
$ gotip env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/usr/local/google/home/bcmills/.cache/go-build"
GOENV="/usr/local/google/home/bcmills/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/usr/local/google/home/bcmills/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/usr/local/google/home/bcmills"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/google/home/bcmills/sdk/gotip"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/google/home/bcmills/sdk/gotip/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="devel go1.18-144e0b1f6 Tue Aug 31 17:35:15 2021 +0000"
GCCGO="/usr/local/google/home/bcmills/bin/gccgo"
AR="ar"
CC="gcc"
CXX="c++"
CGO_ENABLED="1"
GOMOD="/usr/local/google/home/bcmills/src/github.com/bcmills/unsafeslice/go.mod"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4211120039=/tmp/go-build -gno-record-gcc-switches"

What did you do?

In the root of the repository at bcmills/unsafeslice@849066c, run go test ..

What did you expect to see?

A successful test run, or a test failure, or a compile error indicating a problem in my code.

What did you see instead?

~/src/github.com/bcmills/unsafeslice$ gotip test .
# github.com/bcmills/unsafeslice_test
vet: ./safe_test.go:19:2: could not import github.com/bcmills/unsafeslice (cannot import "github.com/bcmills/unsafeslice" (unexpected kind tag in "github.com/bcmills/unsafeslice": 11), possibly version skew - reinstall package)
FAIL    github.com/bcmills/unsafeslice [build failed]
FAIL

CC @griesemer @findleyr @mdempsky @cuonglm

@bcmills bcmills added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker labels Aug 31, 2021
@bcmills bcmills added this to the Go1.18 milestone Aug 31, 2021
@bcmills
Copy link
Contributor Author

bcmills commented Aug 31, 2021

Everything else seems to work at that commit if I bypass vet:

~/src/github.com/bcmills/unsafeslice$ gotip test -vet=off .
ok      github.com/bcmills/unsafeslice  0.018s

@findleyr
Copy link
Contributor

This is because we've fallen behind in go/internal/gcimporter.

I can port the necessary importer changes.

@findleyr findleyr self-assigned this Aug 31, 2021
@findleyr findleyr added the Soon This needs to be done soon. (regressions, serious bugs, outages) label Aug 31, 2021
@gopherbot
Copy link

Change https://golang.org/cl/347069 mentions this issue: go/internal/gcimporter: add support for importing parameterized types

@gopherbot
Copy link

Change https://golang.org/cl/347070 mentions this issue: go/internal/gcimporter: add import tests for type parameters

gopherbot pushed a commit that referenced this issue Sep 2, 2021
Port the necessary logic to go/internal/gcimporter from
cmd/compile/internal/importer/iimport.go to support type parameters.

This is a partial port of several compiler CLs: at least CL 319930,
CL 322609, CL 323029, CL 338192, CL 340251, and CL 340989. Because these
ports were not interleaved with the corresponding go/types API changes,
it is easier to just take the latest importer logic.

Notably, the equivalent of types2.AsTypeParam is not used. It should be
unnecessary.

Updates #48101

Change-Id: I938bd8debc3f6a68a3ad8d44c61ef9c5038be7e5
Reviewed-on: https://go-review.googlesource.com/c/go/+/347069
Trust: Robert Findley <rfindley@google.com>
Trust: Dan Scales <danscales@google.com>
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dan Scales <danscales@google.com>
Reviewed-by: Robert Griesemer <gri@golang.org>
@golang golang locked and limited conversation to collaborators Jun 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. release-blocker Soon This needs to be done soon. (regressions, serious bugs, outages)
Projects
None yet
Development

No branches or pull requests

3 participants