kisielk/errcheck

vgo module support incomplete: transitive dependencies not found

scode opened this issue · 2 comments

scode commented

I know that module support was recently added. However, I think there remains a problem.

This PR against a trivial library demonstrates the problem. I'm adding an external dependency (logrus) which in turn depends on other libraries. Errcheck fails as such:

/home/travis/gopath/pkg/mod/github.com/sirupsen/logrus@v1.0.6/terminal_check_notappengine.go:9:2: could not import golang.org/x/crypto/ssh/terminal (cannot find package "golang.org/x/crypto/ssh/terminal" in any of:
	/home/travis/.gimme/versions/go1.11.linux.amd64/src/golang.org/x/crypto/ssh/terminal (from $GOROOT)
	/home/travis/gopath/src/golang.org/x/crypto/ssh/terminal (from $GOPATH))
/home/travis/gopath/pkg/mod/github.com/sirupsen/logrus@v1.0.6/terminal_linux.go:10:8: could not import golang.org/x/sys/unix (cannot find package "golang.org/x/sys/unix" in any of:
	/home/travis/.gimme/versions/go1.11.linux.amd64/src/golang.org/x/sys/unix (from $GOROOT)
	/home/travis/gopath/src/golang.org/x/sys/unix (from $GOPATH))
error: failed to check packages: could not type check: couldn't load packages due to errors: github.com/sirupsen/logrus

I suspect the rule is that errcheck will succeed if there is only shallow immediate dependencies of the project, but fail if those dependencies in turn depend on other projects. As an example, this PR pulls in a "shallow" dependency that in turn does not depend on anything else, and errcheck is happy.

Module support was just as recently removed

I wouldn't expect errcheck to work with modules at all right now. And fully porting to go/packages is still blocked on upstream.

Closing in favour of #150