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

x/tools/go/analysis/passes/shadow: unexpected type compatibility failure #62519

Closed
shawndx opened this issue Sep 8, 2023 · 4 comments
Closed
Assignees
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@shawndx
Copy link
Contributor

shawndx commented Sep 8, 2023

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

$ go version
go version go1.19.13 linux/amd64

Does this issue reproduce with the latest release?

No, the latest go1.20/21/tip works fine, go1.18/19 is broken (didn't check older releases).

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

go env Output
$ go env
GO111MODULE="auto"
GOARCH="amd64"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOVCS=""
GOVERSION="go1.19.13"
GCCGO="/usr/bin/gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"

What did you do?

go binary set to the latest go1.19.13
% go install golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow@v0.13.0
% cd <go1.19 root>/src/crypto
% go vet -vettool=[path to shadow] $(go list ./...)

What did you expect to see?

No error, or just shadow warnings.

What did you see instead?

A couple of type-checking errors, bitsecting points to the following CL that introduced the behavior change.

commit 7e1bfe8bc98ca8e94b7853eca0993bc9ee369101
Author: Alan Donovan <adonovan@google.com>
Date:   Sun Jul 16 13:14:42 2023 -0400

    go/analysis/unitchecker: Example of separate analysis

type-checking errors:

# crypto/ecdsa
shadow: ecdsa/ecdsa.go:127:12: cannot use asn1.SEQUENCE (constant 48 of type "golang.org/x/crypto/cryptobyte/asn1".Tag) as "vendor/golang.org/x/crypto/cryptobyte/asn1".Tag value in argument to b.AddASN1
# crypto/ecdsa
shadow: ecdsa/ecdsa.go:127:12: cannot use asn1.SEQUENCE (constant 48 of type "golang.org/x/crypto/cryptobyte/asn1".Tag) as "vendor/golang.org/x/crypto/cryptobyte/asn1".Tag value in argument to b.AddASN1
# crypto/rsa
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 8, 2023
@gopherbot gopherbot added this to the Unreleased milestone Sep 8, 2023
@cherrymui cherrymui added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Sep 8, 2023
@cherrymui
Copy link
Member

@timothy-king
Copy link
Contributor

Something suspicious is:

"golang.org/x/crypto/cryptobyte/asn1".Tag

vs

"vendor/golang.org/x/crypto/cryptobyte/asn1".Tag

@adonovan
Copy link
Member

adonovan commented Sep 8, 2023

Thanks for the very helpful bug report; I can reproduce the problem locally with go1.19.5. The code change looks like a no-op, but it's clear that it has changed the vendoring behavior (the subtle difference between "import path" and "package path"). Still investigating...

@adonovan adonovan self-assigned this Sep 8, 2023
@gopherbot
Copy link

Change https://go.dev/cl/526419 mentions this issue: go/analysis/unitchecker: revert subtle change to vendoring

hajimehoshi added a commit to hajimehoshi/ebiten that referenced this issue Oct 4, 2023
There is an issue in golang.org/x/tools@v0.12.0. See golang/go#62519
for the details.

As a temporary solution, just skip using vettools for Go 1.18 and 1.19.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants