-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
66 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,44 @@ | ||
.PHONY: all clean coverage debug-install dependencies fmt install lint markdown test testverbose tools | ||
.PHONY: all clean clean-coverage generate install install-dependencies install-tools lint test test-verbose test-with-coverage | ||
|
||
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
export ARGS := $(wordlist 2,$(words $(MAKECMDGOALS)),$(MAKECMDGOALS)) | ||
export PKG := github.com/zimmski/go-mutesting | ||
export ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) | ||
|
||
all: tools dependencies install test | ||
$(eval $(ARGS):;@:) # turn arguments into do-nothing targets | ||
export ARGS | ||
|
||
all: install-tools install-dependencies install lint test | ||
|
||
clean: | ||
go clean -i ./... | ||
go clean -i -race ./... | ||
coverage: | ||
go test -coverprofile=coverage.out | ||
go tool cover -html=coverage.out | ||
crosscompile: | ||
gox -os="linux" ./... | ||
debug-install: generate | ||
go install -race -v ./... | ||
dependencies: | ||
go get -t -v ./... | ||
go build -v ./... | ||
fmt: | ||
gofmt -l -w $(ROOT_DIR)/ | ||
go clean -i $(PKG)/... | ||
go clean -i -race $(PKG)/... | ||
clean-coverage: | ||
find $(ROOT_DIR) | grep .coverprofile | xargs rm | ||
generate: clean | ||
go install -v ./... | ||
go generate ./... | ||
go generate $(PKG)/... | ||
install: generate | ||
go install -v ./... | ||
lint: install fmt | ||
errcheck github.com/zimmski/go-mutesting/... || true | ||
golint ./... | grep --invert-match -P "(_string.go:)" || true | ||
go tool vet -all=true -v=true $(ROOT_DIR)/ 2>&1 | grep --invert-match -P "(Checking file|\%p of wrong type|can't check non-constant format|not compatible with reflect.StructTag.Get)" || true | ||
markdown: | ||
orange | ||
test: | ||
go test -race ./... | ||
testverbose: | ||
go test -race -v ./... | ||
tools: | ||
go install -v $(PKG)/... | ||
install-dependencies: | ||
go get -t -v $(PKG)/... | ||
go build -v $(PKG)/... | ||
install-tools: | ||
# generation | ||
go get -u golang.org/x/tools/cmd/godoc | ||
go get -u golang.org/x/tools/cmd/stringer | ||
go get -u -v golang.org/x/tools/cmd/stringer | ||
|
||
# linting | ||
go get -u golang.org/x/tools/cmd/vet | ||
go get -u github.com/golang/lint | ||
go install github.com/golang/lint/golint | ||
go get -u github.com/kisielk/errcheck | ||
go get -u -v github.com/golang/lint/... | ||
go get -u -v github.com/kisielk/errcheck/... | ||
|
||
# code coverage | ||
go get -u golang.org/x/tools/cmd/cover | ||
go get github.com/onsi/ginkgo/ginkgo | ||
go get github.com/modocache/gover | ||
go get github.com/mattn/goveralls | ||
go get -u -v golang.org/x/tools/cmd/cover | ||
go get -u -v github.com/onsi/ginkgo/ginkgo/... | ||
go get -u -v github.com/modocache/gover/... | ||
go get -u -v github.com/mattn/goveralls/... | ||
lint: | ||
$(ROOT_DIR)/scripts/lint.sh | ||
test: | ||
go test -race -test.timeout 60s $(PKG)/... | ||
test-verbose: | ||
go test -race -test.timeout 60s -v $(PKG)/... | ||
test-with-coverage: | ||
ginkgo -r -cover -race -skipPackage="testdata" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/sh | ||
|
||
if [ -z ${PKG+x} ]; then echo "PKG is not set"; exit 1; fi | ||
if [ -z ${ROOT_DIR+x} ]; then echo "ROOT_DIR is not set"; exit 1; fi | ||
|
||
echo "gofmt:" | ||
OUT=$(gofmt -l $ROOT_DIR) | ||
if [ $($OUT | wc -l) -ne 0 ]; then echo $OUT; PROBLEM=1; fi | ||
|
||
echo "errcheck:" | ||
OUT=$(errcheck $PKG/...) | ||
if [ $($OUT | wc -l) -ne 0 ]; then echo $OUT; PROBLEM=1; fi | ||
|
||
echo "go vet:" | ||
OUT=$(go tool vet -all=true -v=true $ROOT_DIR 2>&1 | grep --invert-match -P "(Checking file|\%p of wrong type|can't check non-constant format|not compatible with reflect.StructTag.Get)") | ||
if [ $($OUT | wc -l) -ne 0 ]; then echo $OUT; PROBLEM=1; fi | ||
|
||
echo "golint:" | ||
OUT=$(golint $PKG/... | grep --invert-match -P "(_string.go:)") | ||
if [ $($OUT | wc -l) -ne 0 ]; then echo $OUT; PROBLEM=1; fi | ||
|
||
if [ -n "$PROBLEM" ]; then exit 1; fi |