-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
44 lines (33 loc) · 1.92 KB
/
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
BIN="./bin"
SRC=$(shell find . -name "*.go")
ifeq (, $(shell which golangci-lint))
$(warning "could not find golangci-lint in $(PATH), run: curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh")
endif
.PHONY: pre_clean lint test
all: pre_clean lint test darwin linux linux-arm windows
fmt:
$(info ******************** checking formatting ********************)
@test -z $(shell gofmt -l $(SRC)) || (gofmt -d $(SRC); exit 1)
lint:
$(info ******************** running lint tools ********************)
golangci-lint run -v
test:
go test -covermode=atomic -coverprofile=coverage.out ./...
pre_clean:
rm -rf bin
darwin:
VERSION=$$(cat VERSION)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "-X github.com/ditschedev/swag-ts/internal/config.Version=$$(cat VERSION) -X github.com/ditschedev/swag-ts/internal/config.Date=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'`" -o ./bin/swag-ts-darwin-x86_64
chmod +x ./bin/swag-ts-darwin-x86_64
linux:
VERSION=$$(cat VERSION)
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/ditschedev/swag-ts/internal/config.Version=$$(cat VERSION) -X github.com/ditschedev/swag-ts/internal/config.Date=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'`" -o ./bin/swag-ts-linux-x86_64
chmod +x ./bin/swag-ts-linux-x86_64
linux-arm:
VERSION=$$(cat VERSION)
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-X github.com/ditschedev/swag-ts/internal/config.Version=$$(cat VERSION) -X github.com/ditschedev/swag-ts/internal/config.Date=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'`" -o ./bin/swag-ts-linux-arm64
chmod +x ./bin/swag-ts-linux-arm64
windows:
VERSION=$$(cat VERSION)
CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-X github.com/ditschedev/swag-ts/internal/config.Version=$$(cat VERSION) -X github.com/ditschedev/swag-ts/internal/config.Date=`TZ=UTC date -u '+%Y-%m-%dT%H:%M:%SZ'`" -o ./bin/swag-ts-windows-x86_64
chmod +x ./bin/swag-ts-windows-x86_64