flokati/Makefile

37 lines
899 B
Makefile

all: test fmt build
test:
go test ./...
vet:
go vet ./...
fmt:
go fmt ./...
#go list -f '{{.Dir}}' ./... | grep -v /vendor/ | xargs -L1 gofmt -l
#test -z $$(go list -f '{{.Dir}}' ./... | grep -v /vendor/ | xargs -L1 gofmt -l)
lint:
go list ./... | grep -v /vendor/ | xargs -L1 golint -set_exit_status
build: fmt
go build -v -a -o bin/flokati ./cmd/flokati
VERSIONGO=cmd/flokati/version.go
REV=$$(git rev-list HEAD --count)
BUILDDATE=$$(date)
BRANCH=$$(git rev-parse --abbrev-ref HEAD)
TAGS=.tags
docker: fmt
echo "package main" >$(VERSIONGO)
echo "" >>$(VERSIONGO)
echo "const (" >>$(VERSIONGO)
echo " Version = \"$(BRANCH)\"" >>$(VERSIONGO)
echo " Build = \"$(REV)\"" >>$(VERSIONGO)
echo " Builddate = \"$(BUILDDATE)\"" >>$(VERSIONGO)
echo ")" >>$(VERSIONGO)
echo -n "$(BRANCH)-$(REV)" >$(TAGS)
docker build -t dr.dnix.de/flokati .
docker push dr.dnix.de/flokati