-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (26 loc) · 681 Bytes
/
Makefile
File metadata and controls
37 lines (26 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
GOBIN ?= $(shell go env GOPATH)/bin
BIN := pad
VERSION := $(shell git rev-parse --abbrev-ref HEAD)
HASH := $(shell git rev-parse --short HEAD)
DATE := $(shell date +%FT%T%z)
LDFLAGS := "-s -w \
-X main.Version=$(VERSION) \
-X main.CommitHash=$(HASH) \
-X main.CompileDate=$(DATE)"
all: build
build: fmt vet
go build -ldflags=$(LDFLAGS) -o $(GOBIN)/$(BIN)
install:
go install -ldflags=$(LDFLAGS)
test:
go test ./...
clean:
if [ -f $(GOBIN)/$(BIN) ] ; then rm -f $(GOBIN)/$(BIN) ; fi
fmt:
find . -name '*.go' -not -path './.vendor/*' -exec gofmt -w=true {} ';'
vet:
go vet ./...
vendor:
go mod tidy
go mod vendor
.PHONY: build install test clean fmt vet vendor