2016-04-01 22:28:17 +09:00
|
|
|
.PHONY: help check
|
|
|
|
.DEFAULT_GOAL := help
|
|
|
|
|
|
|
|
SUBPKGS=cpu disk docker host internal load mem net process
|
|
|
|
|
|
|
|
help: ## Show help
|
|
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
|
|
|
|
check: ## Check
|
|
|
|
errcheck -ignore="Close|Run|Write" ./...
|
2016-08-15 23:42:31 -07:00
|
|
|
golint ./... | egrep -v 'underscores|HttpOnly|should have comment|comment on exported|CamelCase|VM|UID' && exit 1 || exit 0
|
2016-04-01 22:28:17 +09:00
|
|
|
|
2016-08-22 15:31:26 -07:00
|
|
|
BUILD_FAIL_PATTERN=grep -v "exec format error" | grep "build failed" && exit 1 || exit 0
|
2016-04-01 22:28:17 +09:00
|
|
|
build_test: ## test only buildable
|
2016-08-22 15:31:26 -07:00
|
|
|
# Supported operating systems
|
2018-03-31 21:35:53 +09:00
|
|
|
GOOS=linux GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=linux GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=linux GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=linux GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
|
2022-01-13 15:55:13 +08:00
|
|
|
GOOS=linux GOARCH=loong64 go test ./... | $(BUILD_FAIL_PATTERN)
|
2020-06-25 16:43:12 +02:00
|
|
|
GOOS=linux GOARCH=riscv64 go test ./... | $(BUILD_FAIL_PATTERN)
|
2023-02-07 14:12:31 -08:00
|
|
|
GOOS=linux GOARCH=s390x go test ./... | $(BUILD_FAIL_PATTERN)
|
2024-01-10 23:08:22 +09:00
|
|
|
GOOS=linux GOARCH=mips go test ./... | $(BUILD_FAIL_PATTERN)
|
2022-02-12 08:05:42 +00:00
|
|
|
GOOS=freebsd GOARCH=amd64 go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=freebsd GOARCH=386 go test ./... | $(BUILD_FAIL_PATTERN)
|
2019-01-17 16:49:20 +09:00
|
|
|
GOOS=freebsd GOARCH=arm go test ./... | $(BUILD_FAIL_PATTERN)
|
2022-02-12 08:05:42 +00:00
|
|
|
GOOS=freebsd GOARCH=arm64 go test ./... | $(BUILD_FAIL_PATTERN)
|
2016-08-22 15:31:26 -07:00
|
|
|
CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
GOOS=windows go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
# Operating systems supported for building only (not implemented error if used)
|
|
|
|
GOOS=solaris go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 21:35:53 +09:00
|
|
|
GOOS=dragonfly go test ./... | $(BUILD_FAIL_PATTERN)
|
2017-08-03 11:08:35 +09:00
|
|
|
GOOS=netbsd go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 21:35:53 +09:00
|
|
|
# cross build to OpenBSD not worked since process has "C"
|
|
|
|
# GOOS=openbsd go test ./... | $(BUILD_FAIL_PATTERN)
|
2021-11-06 09:53:56 +00:00
|
|
|
GOOS=plan9 go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 21:35:53 +09:00
|
|
|
|
|
|
|
ifeq ($(shell uname -s), Darwin)
|
2017-12-31 15:25:49 +09:00
|
|
|
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
2018-03-31 21:35:53 +09:00
|
|
|
endif
|
2016-08-22 15:31:26 -07:00
|
|
|
@echo 'Successfully built on all known operating systems'
|
2018-09-16 17:40:02 +09:00
|
|
|
|
2020-10-02 16:18:57 +03:00
|
|
|
vet:
|
|
|
|
GOOS=darwin GOARCH=amd64 go vet ./...
|
|
|
|
GOOS=darwin GOARCH=arm64 go vet ./...
|
|
|
|
|
|
|
|
GOOS=dragonfly GOARCH=amd64 go vet ./...
|
|
|
|
|
|
|
|
GOOS=freebsd GOARCH=amd64 go vet ./...
|
|
|
|
GOOS=freebsd GOARCH=386 go vet ./...
|
|
|
|
GOOS=freebsd GOARCH=arm go vet ./...
|
|
|
|
|
|
|
|
GOOS=linux GOARCH=386 go vet ./...
|
|
|
|
GOOS=linux GOARCH=amd64 go vet ./...
|
|
|
|
GOOS=linux GOARCH=arm64 go vet ./...
|
|
|
|
GOOS=linux GOARCH=arm go vet ./...
|
2022-01-13 15:55:13 +08:00
|
|
|
GOOS=linux GOARCH=loong64 go vet ./...
|
2020-10-02 16:18:57 +03:00
|
|
|
GOOS=linux GOARCH=mips64 go vet ./...
|
|
|
|
GOOS=linux GOARCH=mips64le go vet ./...
|
|
|
|
GOOS=linux GOARCH=mips go vet ./...
|
|
|
|
GOOS=linux GOARCH=mipsle go vet ./...
|
|
|
|
GOOS=linux GOARCH=ppc64le go vet ./...
|
2023-01-03 20:56:48 -05:00
|
|
|
GOOS=linux GOARCH=ppc64 go vet ./...
|
2020-10-02 16:18:57 +03:00
|
|
|
GOOS=linux GOARCH=riscv64 go vet ./...
|
|
|
|
GOOS=linux GOARCH=s390x go vet ./...
|
|
|
|
|
|
|
|
GOOS=netbsd GOARCH=amd64 go vet ./...
|
2021-06-11 03:35:10 +03:00
|
|
|
|
|
|
|
GOOS=openbsd GOARCH=386 go vet ./...
|
|
|
|
GOOS=openbsd GOARCH=amd64 go vet ./...
|
|
|
|
|
2020-10-02 16:18:57 +03:00
|
|
|
GOOS=solaris GOARCH=amd64 go vet ./...
|
|
|
|
|
|
|
|
GOOS=windows GOARCH=amd64 go vet ./...
|
|
|
|
GOOS=windows GOARCH=386 go vet ./...
|
|
|
|
|
2021-11-06 09:53:56 +00:00
|
|
|
GOOS=plan9 GOARCH=amd64 go vet ./...
|
|
|
|
GOOS=plan9 GOARCH=386 go vet ./...
|
|
|
|
|
2020-02-20 10:40:08 +09:00
|
|
|
macos_test:
|
|
|
|
CGO_ENABLED=0 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
CGO_ENABLED=1 GOOS=darwin go test ./... | $(BUILD_FAIL_PATTERN)
|
|
|
|
|
2018-09-16 17:40:02 +09:00
|
|
|
init_tools:
|
|
|
|
go get github.com/golang/dep/cmd/dep
|
2021-10-01 12:53:48 +00:00
|
|
|
|
2024-06-01 08:39:55 +09:00
|
|
|
TAG=$(shell date +'v4.%y.%-m' --date='last Month')
|
2021-11-06 09:53:56 +00:00
|
|
|
|
2021-10-01 12:53:48 +00:00
|
|
|
release:
|
|
|
|
git tag $(TAG)
|
|
|
|
git push origin $(TAG)
|