k3s/vendor/go.uber.org/atomic/Makefile

65 lines
1.5 KiB
Makefile
Raw Normal View History

2019-12-12 01:27:03 +00:00
PACKAGES := $(shell glide nv)
2019-09-27 21:51:53 +00:00
# Many Go tools take file globs or directories as arguments instead of packages.
PACKAGE_FILES ?= *.go
2019-12-12 01:27:03 +00:00
# The linting tools evolve with each Go version, so run them only on the latest
# stable release.
GO_VERSION := $(shell go version | cut -d " " -f 3)
GO_MINOR_VERSION := $(word 2,$(subst ., ,$(GO_VERSION)))
LINTABLE_MINOR_VERSIONS := 7 8
ifneq ($(filter $(LINTABLE_MINOR_VERSIONS),$(GO_MINOR_VERSION)),)
SHOULD_LINT := true
endif
2019-09-27 21:51:53 +00:00
export GO15VENDOREXPERIMENT=1
.PHONY: build
build:
2019-12-12 01:27:03 +00:00
go build -i $(PACKAGES)
2019-09-27 21:51:53 +00:00
.PHONY: install
install:
glide --version || go get github.com/Masterminds/glide
glide install
.PHONY: test
test:
2019-12-12 01:27:03 +00:00
go test -cover -race $(PACKAGES)
2019-09-27 21:51:53 +00:00
.PHONY: install_ci
install_ci: install
go get github.com/wadey/gocovmerge
go get github.com/mattn/goveralls
go get golang.org/x/tools/cmd/cover
2019-12-12 01:27:03 +00:00
ifdef SHOULD_LINT
go get github.com/golang/lint/golint
endif
2019-09-27 21:51:53 +00:00
.PHONY: lint
lint:
2019-12-12 01:27:03 +00:00
ifdef SHOULD_LINT
2019-09-27 21:51:53 +00:00
@rm -rf lint.log
@echo "Checking formatting..."
@gofmt -d -s $(PACKAGE_FILES) 2>&1 | tee lint.log
@echo "Checking vet..."
2019-12-12 01:27:03 +00:00
@$(foreach dir,$(PACKAGE_FILES),go tool vet $(dir) 2>&1 | tee -a lint.log;)
2019-09-27 21:51:53 +00:00
@echo "Checking lint..."
2019-12-12 01:27:03 +00:00
@$(foreach dir,$(PKGS),golint $(dir) 2>&1 | tee -a lint.log;)
2019-09-27 21:51:53 +00:00
@echo "Checking for unresolved FIXMEs..."
@git grep -i fixme | grep -v -e vendor -e Makefile | tee -a lint.log
@[ ! -s lint.log ]
2019-12-12 01:27:03 +00:00
else
@echo "Skipping linters on" $(GO_VERSION)
endif
2019-09-27 21:51:53 +00:00
.PHONY: test_ci
test_ci: install_ci build
./scripts/cover.sh $(shell go list $(PACKAGES))