Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
118 lines (91 sloc) 2.61 KB
PKGS := $(shell go list ./... | grep -v 'go.pedge.io/timetrack/vendor')
export GO15VENDOREXPERIMENT=1
all: build test
version:
@echo 'package main; import "go.pedge.io/timetrack"; func main() { timetrack.Version.Println() }' > /tmp/timetrack_version.go
@go run /tmp/timetrack_version.go
deps:
GO15VENDOREXPERIMENT=0 go get -d -v $(PKGS)
updatedeps:
GO15VENDOREXPERIMENT=0 go get -d -v -u -f $(PKGS)
testdeps:
GO15VENDOREXPERIMENT=0 go get -d -v -t $(PKGS)
updatetestdeps:
GO15VENDOREXPERIMENT=0 go get -d -v -t -u -f $(PKGS)
vendorupdate:
GO15VENDOREXPERIMENT=0 GOOS=linux GOARCH=amd64 go get -d -v -t -u -f $(PKGS)
vendornoupdate:
go get -v github.com/kardianos/govendor
rm -rf vendor
govendor init
GOOS=linux GOARCH=amd64 govendor add +external
GOOS=linux GOARCH=amd64 govendor update +vendor
vendor: vendorupdate vendornoupdate
build:
go build $(PKGS)
install:
go install $(PKGS)
lint:
go get -v github.com/golang/lint/golint
for file in $$(find . -name '*.go' | grep -v 'vendor' | grep -v '\.pb\.go' | grep -v '\.pb\.gw\.go'); do \
golint $${file}; \
if [ -n "$$(golint $${file})" ]; then \
exit 1; \
fi; \
done
vet:
go vet $(PKGS)
errcheck:
go get -v github.com/kisielk/errcheck
errcheck $(PKGS)
pretest: lint errcheck
test: pretest
go test $(PKGS)
clean:
go clean -i $(PKGS)
proto:
go get -v go.pedge.io/protoeasy/cmd/protoeasy
go get -v go.pedge.io/pkg/cmd/strip-package-comments
protoeasy --go --grpc --grpc-gateway --exclude vendor .
find . -name *\.pb\*\.go | xargs strip-package-comments
docker-build-timetrackdev:
docker build -t quay.io/pedge/timetrackdev -f Dockerfile.timetrackdev .
docker-build-timetrackd-internal:
rm -rf _tmp
mkdir -p _tmp
CGO_ENABLED=0 go build -a -installsuffix cgo -o _tmp/timetrackd cmd/timetrackd/main.go
docker build -t quay.io/pedge/timetrackd -f Dockerfile.timetrackd .
docker-build-timetrackd: docker-build-timetrackdev
docker run -v /var/run/docker.sock:/var/run/docker.sock quay.io/pedge/timetrackdev make docker-build-timetrackd-internal
docker-test: docker-build-timetrackdev
docker run quay.io/pedge/timetrackdev make test
docker-launch: docker-build-timetrackd
docker run -d -v /var/lib/timetrack:/var/lib/timetrack -p 7070:7070 -p 8080:8080 quay.io/pedge/timetrackd
launch:
go run cmd/timetrackd/main.go
.PHONY: \
all \
version \
deps \
updatedeps \
testdeps \
updatetestdeps \
vendorupdate \
vendornoupdate \
vendor \
build \
install \
lint \
vet \
errcheck \
pretest \
test \
clean \
proto \
docker-build-timetrackdev \
docker-build-timetrackd-internal \
docker-build-timetrackd \
docker-test \
docker-launch \
launch \
run