Even if there wasn't a -novendor flag, it would be nice if there was a 
consistent way to ignore the /vendor/ directory. This approach was provided 
by Andrew Gerrand's talk "Stupid Gopher Talks":

go test $(go list ./... | grep -v vendor) 

However, the same doesn't work for all tools. The gofmt and golint tools 
report no such file or directory:

gofmt -s -l -w $(go list ./... | grep -v vendor) 
golint $(go list ./... | grep -v vendor)

This means our Makefile has a few different ways of getting the *.go files 
to check, and it took some time to figure out (multiply by every team / new 
project using Go).

Personally, I find it a bit confusing to get all these tools in the first 
place. I've heard that some of the x/tools have moved into core (gofmt) in 
1.6, but some haven't. There are a number of really useful third-party 
tools like gometalinter and gocode too. Right now it looks like each text 
editor / IDE needs to provide installation scripts to get all these tools.

Btw, the open issue for multiple package test coverage is here: 
https://github.com/golang/go/issues/6909

Thanks,
Nathan.

On Tuesday, 18 October 2016 13:27:30 UTC-6, Russ Egan wrote:
>
> 1. A "no vendor" switch (for build, test, fmt, vet, etc) would be nice.
> 2. Multi-package coverage would be nice.  We end up copying this stanza 
> throughout our makefiles:
>
> PACKAGES = $$(go list ./... | grep -v /vendor/)
>
>  
>
> test:
>
> echo 'mode: atomic' > build/coverage.out
>
> for pkg in $(PACKAGES) ; do \
>
> go test -v -covermode=count -coverprofile=build/coverage.tmp $$pkg 2>&1 | 
> tee -a build/test.out; \
>
> if [ -e build/coverage.tmp ] ; then tail -n +2 build/coverage.tmp >> 
> build/coverage.out; rm build/coverage.tmp; fi \
>
> done
>
> go tool cover -html=build/coverage.out -o build/coverage.html
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to