divan/depscheck

compile errors in current Master branch

robbyt opened this issue · 4 comments

I just tried installing this app using Go 1.6 on OS X, and received several compile errors:

$ go get github.com/divan/depscheck
# github.com/divan/depscheck
Documents/gocode/src/github.com/divan/depscheck/walker.go:75: cannot use obj (type "golang.org/x/tools/go/types".Object) as type "go/types".Object in argument to w.WalkObject:
    "golang.org/x/tools/go/types".Object does not implement "go/types".Object (wrong type for Parent method)
        have Parent() *"golang.org/x/tools/go/types".Scope
        want Parent() *"go/types".Scope
Documents/gocode/src/github.com/divan/depscheck/walker.go:123: cannot use pkg.Pkg (type *"golang.org/x/tools/go/types".Package) as type *"go/types".Package in argument to NewSelector
Documents/gocode/src/github.com/divan/depscheck/walker.go:131: cannot use pkg.Pkg (type *"golang.org/x/tools/go/types".Package) as type *"go/types".Package in argument to NewSelector
Documents/gocode/src/github.com/divan/depscheck/walker.go:167: cannot use obj (type "golang.org/x/tools/go/types".Object) as type "go/types".Object in argument to w.WalkObject:
    "golang.org/x/tools/go/types".Object does not implement "go/types".Object (wrong type for Parent method)
        have Parent() *"golang.org/x/tools/go/types".Scope
        want Parent() *"go/types".Scope
Documents/gocode/src/github.com/divan/depscheck/walker.go:186: invalid operation: def == obj (mismatched types "golang.org/x/tools/go/types".Object and "go/types".Object)
Documents/gocode/src/github.com/divan/depscheck/walker.go:187: cannot use def (type "golang.org/x/tools/go/types".Object) as type "go/types".Object in return argument:
    "golang.org/x/tools/go/types".Object does not implement "go/types".Object (wrong type for Parent method)
        have Parent() *"golang.org/x/tools/go/types".Scope
        want Parent() *"go/types".Scope
Documents/gocode/src/github.com/divan/depscheck/walker.go:244: cannot use def (type "golang.org/x/tools/go/types".Object) as type "go/types".Object in return argument:
    "golang.org/x/tools/go/types".Object does not implement "go/types".Object (wrong type for Parent method)
        have Parent() *"golang.org/x/tools/go/types".Scope
        want Parent() *"go/types".Scope
divan commented

The most probable reason is outdated golang.org/x/tools/go/types in your GOPATH.
Can you update it to the latest master and try with it?
Simple cd $GOPATH/src/golang.org/x/tools/go/types && git pull should do the job.

$ cd $GOPATH/src/golang.org/x/tools/go/types && git pull
Already up-to-date.
$ git log
commit 84e7bc0dd39bab24b696dde4d714641fa738f945
Author: Alan Donovan <alan@alandonovan.net>
Date:   Tue Mar 29 14:32:15 2016 -0400

Thank you!
I just uninstalled golang.org/x/tools/go/types and reinstalled it, and now depscheck works.

I think my build of types was compiled with go 1.5.

@divan, is there a reason you couldn't just merge your "installation" and "update" steps in https://github.com/divan/depscheck#installation so that it's the same command:

To install or update:

go get -u github.com/divan/depscheck

Doing go get -u will work both to install (avoiding problem where someone may have outdated dependencies) and to update.