-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (39 loc) · 924 Bytes
/
Makefile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
SHELL = /bin/bash
all: go-build
# --- Go(Golang) ------------------------------------------------------------------------------------
GOCMD=go
GOMOD=$(GOCMD) mod
GOGET=$(GOCMD) get
GOFMT=$(GOCMD) fmt
GOTEST=$(GOCMD) test
GOBUILD=$(GOCMD) build
GOINSTALL=$(GOCMD) install
GOFLAGS := -v
LDFLAGS := -s -w
ifneq ($(shell go env GOOS),darwin)
LDFLAGS := -extldflags "-static"
endif
GOLANGCILINTCMD=golangci-lint
GOLANGCILINTRUN=$(GOLANGCILINTCMD) run
.PHONY: go-mod-tidy
go-mod-tidy:
$(GOMOD) tidy
.PHONY: go-mod-update
go-mod-update:
$(GOGET) -f -t -u ./...
$(GOGET) -f -u ./...
.PHONY: go-fmt
go-fmt:
$(GOFMT) ./...
.PHONY: go-lint
go-lint: go-fmt
$(GOLANGCILINTRUN) $(GOLANGCILINT) ./...
.PHONY: go-test
go-test:
$(GOTEST) $(GOFLAGS) ./...
.PHONY: go-build
go-build:
$(GOBUILD) $(GOFLAGS) -ldflags '$(LDFLAGS)' -o bin/xstream cmd/xstream/main.go
.PHONY: go-install
go-install:
$(GOINSTALL) $(GOFLAGS) ./...