-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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/packages: internal error: package ... without types was imported from ... #37617
Comments
I'm getting this with go-sumtype. It fails on a single package main
import (
"errors"
)
func main() {
_ = errors.New("x")
} Then: $ go-sumtype main.go
internal error: package "errors" without types was imported from "command-line-arguments" |
@atombender, go-sumtype does fail when run on main.go, but it looks like that's due to it using an old version of golang.org/x/tools/go/packages. When its dependency on go/tools is updated in its go.mod file (I updated it to v0.0.0-20200423205358-59e73619c742) the error no longer occurs. @mmcloughlin I'm wondering if you could give me more specific instructions for reproducing locally? |
Add go 1.14 to CI testing. Upgrade golang.org/x/tools dependency to resolve golang/go#37617.
@matloob I'm not seeing this in the latest |
Great, thanks! Will close this issue. |
See issue golang/go#37617
Just a quick comment in case someone else see this, though probably not super helpful... Right now, I'm seeing a couple different flavors of this issue:
and
Two possible correlating factors:
If I sort this out more, I will add more here, or open a new issue. |
Updating to the golang.org/x/tools@latest (v0.1.8) and rebuilding my binary seems to have solved the issue. That wasn't the first thing I tried because I was seeing the problem with a relatively recent version of x/tools:
So maybe something related to x/tools being recent, but too far behind tip? (And perhaps similar to #49164, #49159, marwan-at-work/mod#9, and perhaps others as I google a bit more now). @matloob I am going to re-open this issue so it at least pops up on your radar or in case something like a different error is useful, but please of course feel free to close if no action is warranted here. Thanks, and sorry for the noise! |
given the length of time passed, new issues should probably be filed as new issues. |
This commit resolves an issue where on Go 1.19, errors of the following form appear, when an internal package "xyz" would import from the standard library. internal error: package "fmt" without types was imported from "xyz" This problem was discussed in the Go issue tracker here as well: golang/go#37617 Closes BurntSushi/go-sumtype#17
Old tools version casued the issue described in golang/go#37617 to manifest when validating certain codebases. Bumping golang.org/x/tools to latest version resolves that.
I have seen errors similar to golang/go#37617: Executing checks failed with: ``` check-errs ./... errs: internal error: package "errors" without types was imported from "storj.io/gateway-mt/pkg/errdata" errs: internal error: package "context" without types was imported from "storj.io/gateway-mt/pkg/backoff" ``` Looks like the solution - bump x/tools as suggested in the mentioned issue - worked well. Change-Id: Ia871dafb1a42a9e6bb99feea7ce4885cc50786f2
In case someone has this issue nowadays..... update the deps! sometimes, idk why, the go tools package is installed in a previous version. |
Old tools version casued the issue described in golang/go#37617 to manifest when validating certain codebases. Bumping golang.org/x/tools to latest version resolves that.
Still seeing this issue after running
|
I'm getting this issue now as well. |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes, and not with prior releases.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I ran into this problem when attempting to upgrade to Go 1.14 in my
avo
project. The lint CI job fails for Go 1.14:mmcloughlin/avo#138
The error is actually in the
asmdecl
step, which is a standalone version of theasmdecl
static analyzer ingo vet
:https://github.com/mmcloughlin/avo/blob/6df701fe672f960f4aa5dde1424633110a857953/internal/cmd/asmdecl/main.go
The CI job compiles this binary and runs it over the whole project, with
asmdecl ./...
.What did you expect to see?
Under Go 1.13.8, running this over the whole
avo
project exits without errorI expected the same under Go 1.14.
What did you see instead?
The text was updated successfully, but these errors were encountered: