Makefile 341 B

123456789101112131415161718
  1. VERSION := $(shell git describe --tags --abbrev=0)
  2. BUILDTIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
  3. GOLDFLAGS += -X main.Version=$(VERSION)
  4. GOLDFLAGS += -X main.Buildtime=$(BUILDTIME)
  5. GOFLAGS = -ldflags "$(GOLDFLAGS)"
  6. run: build
  7. ./gof
  8. dry-run: build
  9. ./gof -dry-run
  10. build:
  11. go build -o gof $(GOFLAGS) .
  12. test: build
  13. go test -v ./...