divan / depscheck Goto Github PK
View Code? Open in Web Editor NEWDependency checker for Golang (Go) packages. Prints stats and suggests to remove small LeftPad-like imports if any.
License: MIT License
Dependency checker for Golang (Go) packages. Prints stats and suggests to remove small LeftPad-like imports if any.
License: MIT License
I imagine some sort of dependency that I'm missing, though I got Golang tools loader. I don't know. I'm on Go 1.6. Maybe I need to update something?
# github.com/divan/depscheck
../sites/go/src/github.com/divan/depscheck/walker.go:73: w.P.Package undefined (type *loader.Program has no field or method Package)
../sites/go/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
../sites/go/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
../sites/go/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
../sites/go/src/github.com/divan/depscheck/walker.go:166: w.P.Package undefined (type *loader.Program has no field or method Package)
../sites/go/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
../sites/go/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)
../sites/go/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
../sites/go/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
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
I personally suggest a CI integration with travis
Or depscheck report Lumberjack as a good candidate for removing from dependencies, when it isn't:
- Package lumberjack (gopkg.in/natefinch/lumberjack.v2) is a good candidate for removing from dependencies.
Only 0 LOC used, in 1 calls, with 0 level of nesting
Standard usage pattern of Lumberjack is, to quote readme,
log.SetOutput(&lumberjack.Logger{
Filename: "/var/log/myapp/foo.log",
MaxSize: 500, // megabytes
MaxBackups: 3,
MaxAge: 28, //days
})
with log
interacting with inner implementation of lumberjack.Logger
as io.WriteCloser.
This is misleading, and may be a good candidate to improve code or add as example of false positive in Readme.
I'd love to see a support for doing the stats recursively on all the sub packages of a certain package excluding the vendor directory.
Thanks.
Since this is a "binary only dependency" i would personally prefer having only the binary, effectively improve my CI build time
I also suggest the awesome https://goreleaser.com/ to automate creation and publish of binaries. What do you think ?
It would be nice to be able to exclude internal packages from checks. For instance with -omitinternal
flag
E.g. I have some small subpackages in my package for separation of logic. Think it's a modules but not dependencies.
I can make PR for that.
What do you think?
Would it make sense to work with gometalinter to get this included in the tests it can run?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.