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/go2go: type checking fails for golang.org/x/tools/go/packages #40418

Closed
FiloSottile opened this issue Jul 26, 2020 · 5 comments
Closed

cmd/go2go: type checking fails for golang.org/x/tools/go/packages #40418

FiloSottile opened this issue Jul 26, 2020 · 5 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@FiloSottile
Copy link
Contributor

When running the latest go2go translate on this file

package main

import "golang.org/x/tools/go/packages"

func main() {
	_ = packages.Package{}
}

I get this error

type checking failed for main
repro.go2:3:8: could not import golang.org/x/tools/go/packages (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/go/packages/packages.go:26:2: could not import golang.org/x/tools/go/gcexportdata (importing "golang.org/x/tools/go/gcexportdata": multiple Go packages in /Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/go/gcexportdata)
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/go/packages/packages.go:27:2: could not import golang.org/x/tools/internal/gocommand (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/gocommand/invoke.go:20:2: could not import golang.org/x/tools/internal/event (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:10:2: could not import golang.org/x/tools/internal/event/core (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:18:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:27:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:36:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:44:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:56:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:60:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:70:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:75:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
)
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:30:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:46:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:47:3: cannot use keys.Err.Of(err) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:62:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:76:3: cannot use keys.Label.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:93:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:96:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:118:3: cannot use keys.Detach.New() (value of type label.Label) as label.Label value in array or slice literal
)
)
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/go/packages/packages.go:28:2: could not import golang.org/x/tools/internal/packagesinternal (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/packagesinternal/packages.go:5:2: could not import golang.org/x/tools/internal/gocommand (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/gocommand/invoke.go:20:2: could not import golang.org/x/tools/internal/event (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:10:2: could not import golang.org/x/tools/internal/event/core (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:18:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:27:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:36:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:44:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:56:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:60:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:70:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:75:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
)
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:30:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:46:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:47:3: cannot use keys.Err.Of(err) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:62:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:76:3: cannot use keys.Label.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:93:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:96:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:118:3: cannot use keys.Detach.New() (value of type label.Label) as label.Label value in array or slice literal
)
)
)
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/go/packages/golist.go:25:2: could not import golang.org/x/tools/go/internal/packagesdriver (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/go/internal/packagesdriver/sizes.go:17:2: could not import golang.org/x/tools/internal/gocommand (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/gocommand/invoke.go:20:2: could not import golang.org/x/tools/internal/event (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:10:2: could not import golang.org/x/tools/internal/event/core (/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:18:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:27:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:36:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:44:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:56:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:60:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:70:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/core/fast.go:75:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
)
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:30:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:46:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:47:3: cannot use keys.Err.Of(err) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:62:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:76:3: cannot use keys.Label.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:93:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:96:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/pkg/mod/golang.org/x/tools@v0.0.0-20200725200936-102e7d357031/internal/event/event.go:118:3: cannot use keys.Detach.New() (value of type label.Label) as label.Label value in array or slice literal
)
)
)
)
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jul 26, 2020
@dmitshur dmitshur added this to the Backlog milestone Jul 26, 2020
@stamblerre
Copy link
Contributor

From working on the go2go-compatible gopls, I know that x/tools will not compile with go2go due to some incompatibilities with the go/types API (https://github.com/golang/tools/tree/dev.go2go). I'm not sure if anything has changed in the last few weeks. I'd also make sure that you're in GOPATH mode, I'm not sure if the prototype works well with modules.

@dmitshur dmitshur modified the milestones: Backlog, Unreleased Jul 26, 2020
@ianlancetaylor
Copy link
Contributor

The experimental generics prototype doesn't support modules at all.

@FiloSottile
Copy link
Contributor Author

The experimental generics prototype doesn't support modules at all.

I don't think it's due to modules, the error is approximately the same after go mod vendor and with GO111MODULES=0.

type checking failed for main
main.go2:9:2: could not import golang.org/x/tools/go/packages (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/packages/packages.go:26:2: could not import golang.org/x/tools/go/gcexportdata (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/gcexportdata/gcexportdata.go:32:2: could not import golang.org/x/tools/go/internal/gcimporter (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface11.go:11:6: newInterface redeclared in this block
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/newInterface10.go:11:6: 	other declaration of newInterface
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go:351:7: t (variable of type types.Type) cannot have dynamic type *dddSlice (missing method Array)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bexport.go:545:8: cannot use &(dddSlice literal) (value of type *dddSlice) as types.Type value in assignment: missing method Array
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go:396:53: cannot use t (variable of type *dddSlice) as types.Type value in return statement: missing method Array
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go:490:13: cannot use t (variable of type *dddSlice) as types.Type value in argument: missing method Array
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go:494:10: cannot use t (variable of type *dddSlice) as types.Type value in return statement: missing method Array
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go:711:15: t (variable of type types.Type) cannot have dynamic type *dddSlice (missing method Array)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go:1030:4: cannot use (anyType literal) (value of type anyType) as types.Type value in array or slice literal: missing method Array
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/gcimporter/bimport.go:1038:51: cannot use t (variable of type anyType) as types.Type value in return statement: missing method Array
)
)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/packages/packages.go:27:2: could not import golang.org/x/tools/internal/gocommand (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/gocommand/invoke.go:20:2: could not import golang.org/x/tools/internal/event (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:10:2: could not import golang.org/x/tools/internal/event/core (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:18:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:27:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:36:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:44:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:56:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:60:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:70:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:75:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:30:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:46:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:47:3: cannot use keys.Err.Of(err) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:62:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:76:3: cannot use keys.Label.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:93:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:96:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:118:3: cannot use keys.Detach.New() (value of type label.Label) as label.Label value in array or slice literal
)
)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/packages/packages.go:28:2: could not import golang.org/x/tools/internal/packagesinternal (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/packagesinternal/packages.go:5:2: could not import golang.org/x/tools/internal/gocommand (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/gocommand/invoke.go:20:2: could not import golang.org/x/tools/internal/event (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:10:2: could not import golang.org/x/tools/internal/event/core (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:18:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:27:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:36:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:44:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:56:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:60:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:70:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:75:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:30:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:46:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:47:3: cannot use keys.Err.Of(err) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:62:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:76:3: cannot use keys.Label.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:93:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:96:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:118:3: cannot use keys.Detach.New() (value of type label.Label) as label.Label value in array or slice literal
)
)
)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/packages/golist.go:25:2: could not import golang.org/x/tools/go/internal/packagesdriver (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/go/internal/packagesdriver/sizes.go:17:2: could not import golang.org/x/tools/internal/gocommand (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/gocommand/invoke.go:20:2: could not import golang.org/x/tools/internal/event (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:10:2: could not import golang.org/x/tools/internal/event/core (/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:18:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:27:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:36:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:44:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:56:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:60:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:70:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/core/fast.go:75:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
)
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:30:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:46:3: cannot use keys.Msg.Of(message) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:47:3: cannot use keys.Err.Of(err) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:62:3: cannot use keys.Metric.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:76:3: cannot use keys.Label.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:93:4: cannot use keys.Start.Of(name) (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:96:4: cannot use keys.End.New() (value of type label.Label) as label.Label value in array or slice literal
/Users/filippo/src/github.com/FiloSottile/mostly-harmless/gloc/vendor/golang.org/x/tools/internal/event/event.go:118:3: cannot use keys.Detach.New() (value of type label.Label) as label.Label value in array or slice literal
)
)
)
)

If it is due to modules, the error message could be improved: I would expect the tool to either assume GO111MODULES=0 or error out when modules are in use, not to complain about types.

@ianlancetaylor
Copy link
Contributor

You're right, it's not modules. The tool is confused by the package golang.org/x/tools/go/gcexportdata. The tool doesn't support build tags. It's getting an error "multiple Go packages in /home/iant/gopath/src/golang.org/x/tools/go/gcexportdata". It's because that package has a main.go file with +build ignore. There is nothing in the experimental tool which lets it skip that file.

This isn't something I intend to fix. If someone else wants to fix it, that would be fine. Sorry.

@seankhliao
Copy link
Member

No longer relevant

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Jun 15, 2022
@golang golang locked and limited conversation to collaborators Jun 15, 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.
Projects
None yet
Development

No branches or pull requests

6 participants