diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a3b9bea --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +/release diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9279011 --- /dev/null +++ b/Makefile @@ -0,0 +1,32 @@ +GO_FILES := $(shell find . -iname '*.go' -type f | grep -v /vendor/) # All the .go files, excluding vendor/ + +BINARY := heartbeet +PLATFORMS := windows linux darwin +VERSION ?= latest +os = $(word 1, $@) + +bootstrap: + go get -u golang.org/x/lint/golint # Linter + go get -u honnef.co/go/tools/cmd/staticcheck # Badass static analyzer/linter + # go get honnef.co/go/tools/cmd/megacheck # Badass static analyzer/linter + go get -u github.com/fzipp/gocyclo # Cyclomatic complexity check + go mod download + +test: + go test -v -race $(PKGS) # Normal Test + go vet ./... # go vet is the official Go static analyzer + staticcheck ./... # "go vet on steroids" + linter + gocyclo -over 19 $(GO_FILES) # forbid code with huge functions + golint -set_exit_status $(PKGS) # one last linter + + +$(PLATFORMS): + mkdir -p release + GOOS=$(os) GOARCH=amd64 go build -o release/$(BINARY)-$(VERSION)-$(os)-amd64 + tar -czvf release/$(BINARY)-$(VERSION)-$(os)-amd64.tar.gz README.md -C release/ $(BINARY)-$(VERSION)-$(os)-amd64 + +.PHONY: release +release: windows linux darwin + +clean: + rm -rf release/* diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..e69de29