Update: added Makefile, .gitignore and go.sum

pull/1/head
Darshil Chanpura 2019-09-03 11:34:50 +05:30
parent 28cbefea57
commit 3b4f423055
3 changed files with 34 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
.DS_Store
/release

32
Makefile Normal file
View File

@ -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/*

0
go.sum Normal file
View File