2017-02-08 21:56:07 +00:00
|
|
|
TOOLS= golang.org/x/tools/cover
|
|
|
|
GOCOVER_TMPFILE?= $(GOCOVER_FILE).tmp
|
|
|
|
GOCOVER_FILE?= .cover.out
|
|
|
|
GOCOVERHTML?= coverage.html
|
2017-05-23 23:40:20 +00:00
|
|
|
FIND=`/usr/bin/which 2> /dev/null gfind find | /usr/bin/grep -v ^no | /usr/bin/head -n 1`
|
|
|
|
XARGS=`/usr/bin/which 2> /dev/null gxargs xargs | /usr/bin/grep -v ^no | /usr/bin/head -n 1`
|
2017-02-08 21:56:07 +00:00
|
|
|
|
|
|
|
test:: $(GOCOVER_FILE)
|
|
|
|
@$(MAKE) -C cmd/sockaddr test
|
|
|
|
|
|
|
|
cover:: coverage_report
|
|
|
|
|
|
|
|
$(GOCOVER_FILE)::
|
2017-05-23 23:40:20 +00:00
|
|
|
@${FIND} . -type d ! -path '*cmd*' ! -path '*.git*' -print0 | ${XARGS} -0 -I % sh -ec "cd % && rm -f $(GOCOVER_TMPFILE) && go test -coverprofile=$(GOCOVER_TMPFILE)"
|
2017-02-08 21:56:07 +00:00
|
|
|
|
|
|
|
@echo 'mode: set' > $(GOCOVER_FILE)
|
2017-05-23 23:40:20 +00:00
|
|
|
@${FIND} . -type f ! -path '*cmd*' ! -path '*.git*' -name "$(GOCOVER_TMPFILE)" -print0 | ${XARGS} -0 -n1 cat $(GOCOVER_TMPFILE) | grep -v '^mode: ' >> ${PWD}/$(GOCOVER_FILE)
|
2017-02-08 21:56:07 +00:00
|
|
|
|
|
|
|
$(GOCOVERHTML): $(GOCOVER_FILE)
|
|
|
|
go tool cover -html=$(GOCOVER_FILE) -o $(GOCOVERHTML)
|
|
|
|
|
|
|
|
coverage_report:: $(GOCOVER_FILE)
|
|
|
|
go tool cover -html=$(GOCOVER_FILE)
|
|
|
|
|
|
|
|
audit_tools::
|
|
|
|
@go get -u github.com/golang/lint/golint && echo "Installed golint:"
|
|
|
|
@go get -u github.com/fzipp/gocyclo && echo "Installed gocyclo:"
|
|
|
|
@go get -u github.com/remyoudompheng/go-misc/deadcode && echo "Installed deadcode:"
|
|
|
|
@go get -u github.com/client9/misspell/cmd/misspell && echo "Installed misspell:"
|
|
|
|
@go get -u github.com/gordonklaus/ineffassign && echo "Installed ineffassign:"
|
|
|
|
|
|
|
|
audit::
|
|
|
|
deadcode
|
|
|
|
go tool vet -all *.go
|
|
|
|
go tool vet -shadow=true *.go
|
|
|
|
golint *.go
|
|
|
|
ineffassign .
|
|
|
|
gocyclo -over 65 *.go
|
|
|
|
misspell *.go
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f $(GOCOVER_FILE) $(GOCOVERHTML)
|
|
|
|
|
|
|
|
dev::
|
|
|
|
@go build
|
2017-05-23 23:40:20 +00:00
|
|
|
@$(MAKE) -B -C cmd/sockaddr sockaddr
|
2017-02-08 21:56:07 +00:00
|
|
|
|
|
|
|
install::
|
|
|
|
@go install
|
2017-05-23 23:40:20 +00:00
|
|
|
@$(MAKE) -C cmd/sockaddr install
|
2017-02-08 21:56:07 +00:00
|
|
|
|
|
|
|
doc::
|
2017-05-23 23:40:20 +00:00
|
|
|
@echo Visit: http://127.0.0.1:6161/pkg/github.com/hashicorp/go-sockaddr/
|
|
|
|
godoc -http=:6161 -goroot $GOROOT
|
2017-02-08 21:56:07 +00:00
|
|
|
|
|
|
|
world::
|
|
|
|
@set -e; \
|
|
|
|
for os in solaris darwin freebsd linux windows; do \
|
|
|
|
for arch in amd64; do \
|
|
|
|
printf "Building on %s-%s\n" "$${os}" "$${arch}" ; \
|
|
|
|
env GOOS="$${os}" GOARCH="$${arch}" go build -o /dev/null; \
|
|
|
|
done; \
|
|
|
|
done
|
|
|
|
|
2017-05-23 23:40:20 +00:00
|
|
|
$(MAKE) -C cmd/sockaddr world
|