mvdan/interfacer

Some imports fail

Closed this issue · 2 comments

mvdan commented

For example:

$ cd $GOPATH/src/github.com/mvdan/fdroidcl/cmd/fdroidcl
$ interfacer .
devices.go:10:2: could not import github.com/mvdan/fdroidcl/adb (can't find import: github.com/mvdan/fdroidcl/adb)

go build succeeds. I should note that gotype also fails:

 % gotype .
devices.go:10:2: could not import github.com/mvdan/fdroidcl/adb (can't find import: github.com/mvdan/fdroidcl/adb)

Almost all imports work. The fact that gotype fails and seeing how we don't import packages ourselves, it could be a bug in a go/* package.

The only pattern I have seen that these follow is that they go back up in the GOPATH source tree - foo/bar imports foo, etc.

mvdan commented

I used to be able to run:

cd $GOPATH/src/k8s.io/kubernetes
GOPATH="$(godep path):$GOPATH" interfacer -v ./pkg/...

But after pulling from the kubernetes repo, it now fails very early:

pkg/admission/plugins.go:25:2: could not import github.com/golang/glog (can't find import: github.com/golang/glog)

gotype fails with the exact same error. k8s.io/kubernetes packages did import github.com packages before, so I don't see a clear pattern yet.

mvdan commented

Thanks to @griesemer for pointing out that this is indeed just golang/go#11415. I'll go ahead and use golang.org/x/tools/go/loader as suggested.