I use Go's vendoring (with Glide) to retrieve version pinned package dependencies, into a vendor subdirectory.
gosimple and staticcheck both require the vendor directory to be correct populated before I can successfully run them.
I have project specific packages in subdirectories which I would like to include when I run gosimple.
However, using gosimple ./... also includes the vendor subdirectory, so I get a lot of messages on 3rd party packages that I'm not going to fix ;-)
Is there an elegant way to run gosimple over ./... yet exclude the vendor directory?
Thanks.
I'd use staticcheck $(go list | grep -v /vendor/)
If you arrive at this issue and are using newer versions of go, know that you don't even need the grep anymore. Most of the go tools have been changed to ignore vendored dependencies, including go list. All you need is:
staticcheck $(go list)
or, if you want to do the current package directory and all its sub-packages:
staticcheck $(go list ./...)
@dpetersen Even simpler, you can use staticcheck ./.... If your version of the github.com/kisielk/gotool dependency is reasonably new, it will use Go 1.9's interpretation of ..., which skips vendor.
@dominikh awesome, thanks! You're right, my version of gotool was from June, and updating it made everything work perfectly with vendoring.
Most helpful comment
I'd use
staticcheck $(go list | grep -v /vendor/)