diff options
author | Brent Baude <bbaude@redhat.com> | 2019-09-17 13:58:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-17 13:58:29 -0500 |
commit | 5fc335c6eadb289fd5602ef6e53a65300d5f7204 (patch) | |
tree | 3c4bab62ac05fbffb483dc6061bb05972416c654 | |
parent | 394c06f491fe9f1c28a410e3b0b91916a5119406 (diff) | |
parent | 3d7730fd54be2ed889da59f4604a4ad61ab311cc (diff) |
Merge pull request #2 from baude/validate
add makefile
-rw-r--r-- | Dockerfile.fedora | 2 | ||||
-rw-r--r-- | Makefile | 55 |
2 files changed, 57 insertions, 0 deletions
diff --git a/Dockerfile.fedora b/Dockerfile.fedora new file mode 100644 index 0000000..437bce0 --- /dev/null +++ b/Dockerfile.fedora @@ -0,0 +1,2 @@ +FROM registry.fedoraproject.org/fedora:latest +RUN dnf update && dnf install -y golang && dnf -y clean all diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ef53f6a --- /dev/null +++ b/Makefile @@ -0,0 +1,55 @@ +GO ?= go +EPOCH_TEST_COMMIT ?= 394c06f491fe9f1c28a410e3b0b91916a5119406 + +FIRST_GOPATH := $(firstword $(subst :, ,$(GOPATH))) +GOPKGDIR := $(FIRST_GOPATH)/src/$(PROJECT) +GOPKGBASEDIR ?= $(shell dirname "$(GOPKGDIR)") + +GO_BUILD=$(GO) build +GOBIN := $(shell $(GO) env GOBIN) +ifeq ($(GOBIN),) +GOBIN := $(FIRST_GOPATH)/bin +endif + +validate: gofmt .gitvalidation lint + +gofmt: + find . -name '*.go' ! -path './vendor/*' -exec gofmt -s -w {} \+ + git diff --exit-code + + +.PHONY: .gitvalidation +.gitvalidation: + GIT_CHECK_EXCLUDE="./vendor" $(GOBIN)/git-validation -v -run DCO,short-subject,dangling-whitespace -range $(EPOCH_TEST_COMMIT)..$(HEAD) + +.PHONY: install.tools +install.tools: .install.gitvalidation .install.ginkgo .install.golangci-lint + +lint: .install.golangci-lint + $(GOBIN)/golangci-lint run --tests=false + +define go-get + env GO111MODULE=off \ + $(GO) get -u ${1} +endef + +.install.ginkgo: + if [ ! -x "$(GOBIN)/ginkgo" ]; then \ + $(call go-get,github.com/onsi/ginkgo); \ + fi + +.install.gitvalidation: + if [ ! -x "$(GOBIN)/git-validation" ]; then \ + $(call go-get,github.com/vbatts/git-validation); \ + fi + +.install.golangci-lint: + if [ ! -x "$(GOBIN)/golangci-lint" ]; then \ + curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOBIN)/ v1.17.1; \ + fi + + +.PHONY: \ + gofmt \ + lint \ + validate |