1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- unexport GOBIN
- GO ?= go
- GOFMT ?= $(GO)fmt
- FIRST_GOPATH := $(firstword $(subst :, ,$(shell $(GO) env GOPATH)))
- STATICCHECK := $(FIRST_GOPATH)/bin/staticcheck
- pkgs = $(shell $(GO) list ./... | grep -v /vendor/)
- PREFIX ?= $(shell pwd)
- BIN_DIR ?= $(shell pwd)
- ifdef DEBUG
- bindata_flags = -debug
- endif
- STATICCHECK_IGNORE =
- all: format staticcheck build test
- style:
- @echo ">> checking code style"
- @! $(GOFMT) -d $(shell find . -path ./vendor -prune -o -name '*.go' -print) | grep '^'
- check_license:
- @echo ">> checking license header"
- @./scripts/check_license.sh
- test: fixtures/.unpacked sysfs/fixtures/.unpacked
- @echo ">> running all tests"
- @$(GO) test -race $(shell $(GO) list ./... | grep -v /vendor/ | grep -v examples)
- format:
- @echo ">> formatting code"
- @$(GO) fmt $(pkgs)
- vet:
- @echo ">> vetting code"
- @$(GO) vet $(pkgs)
- staticcheck: $(STATICCHECK)
- @echo ">> running staticcheck"
- @$(STATICCHECK) -ignore "$(STATICCHECK_IGNORE)" $(pkgs)
- %/.unpacked: %.ttar
- ./ttar -C $(dir $*) -x -f $*.ttar
- touch $@
- update_fixtures: fixtures.ttar sysfs/fixtures.ttar
- %fixtures.ttar: %/fixtures
- rm -v $(dir $*)fixtures/.unpacked
- ./ttar -C $(dir $*) -c -f $*fixtures.ttar fixtures/
- $(FIRST_GOPATH)/bin/staticcheck:
- @GOOS= GOARCH= $(GO) get -u honnef.co/go/tools/cmd/staticcheck
- .PHONY: all style check_license format test vet staticcheck
- .PHONY: $(GOPATH)/bin/staticcheck
|