Skip to content

x/tools/go/packages: internal error: package ... without types was imported from ... #37617

@mmcloughlin

Description

@mmcloughlin

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

$ go version
go version go1.14 darwin/amd64

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 Output
$ go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/michaelmcloughlin/Library/Caches/go-build"
GOENV="/Users/michaelmcloughlin/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/michaelmcloughlin/Development/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.14/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.14/libexec/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/michaelmcloughlin/Development/avo/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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/p5/84p384bs42v7pbgfx0db9gq80000gn/T/go-build266927286=/tmp/go-build -gno-record-gcc-switches -fno-common"

What 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 the asmdecl static analyzer in go vet:

https://github.com/mmcloughlin/avo/blob/6df701fe672f960f4aa5dde1424633110a857953/internal/cmd/asmdecl/main.go

// Command asmdecl reports mismatches between assembly files and Go declarations.
//
// Standalone version of the static analyzer in go vet.
package main

import (
	"golang.org/x/tools/go/analysis/passes/asmdecl"
	"golang.org/x/tools/go/analysis/singlechecker"
)

func main() { singlechecker.Main(asmdecl.Analyzer) }

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 error

$ go1.13.8 run ./internal/cmd/asmdecl/ ./...

I expected the same under Go 1.14.

What did you see instead?

$ go1.14 run ./internal/cmd/asmdecl/ ./...
asmdecl: internal error: package "fmt" without types was imported from "github.com/mmcloughlin/avo/attr"
exit status 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolsThis label describes issues relating to any tools in the x/tools repository.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions