1- PROJECT_NAME := azure-debug-info
1+ PROJECT_NAME := $( shell basename $( CURDIR ) )
22GIT_TAG := $(shell git describe --dirty --tags --always)
33GIT_COMMIT := $(shell git rev-parse --short HEAD)
4- LDFLAGS := -X "main.gitTag=$(GIT_TAG ) " -X "main.gitCommit=$(GIT_COMMIT ) " -extldflags "-static"
4+ LDFLAGS := -X "main.gitTag=$(GIT_TAG ) " -X "main.gitCommit=$(GIT_COMMIT ) " -extldflags "-static" -s -w
55
66FIRST_GOPATH := $(firstword $(subst :, ,$(shell go env GOPATH) ) )
77GOLANGCI_LINT_BIN := $(FIRST_GOPATH ) /bin/golangci-lint
8+ GOSEC_BIN := $(FIRST_GOPATH ) /bin/gosec
89
910.PHONY : all
1011all : build
1516
1617.PHONY : build
1718build :
18- CGO_ENABLED=0 go build -a -ldflags ' $(LDFLAGS)' -o $(PROJECT_NAME ) .
19+ GOOS= ${GOOS} GOARCH= ${GOARCH} CGO_ENABLED=0 go build -a -ldflags ' $(LDFLAGS)' -o $(PROJECT_NAME ) .
1920
2021.PHONY : vendor
2122vendor :
@@ -28,18 +29,30 @@ image: build
2829 docker build -t $(PROJECT_NAME ) :$(GIT_TAG ) .
2930
3031build-push-development :
31- docker build -t webdevops/$(PROJECT_NAME ) :development . && docker push webdevops/$(PROJECT_NAME ) :development
32+ docker buildx create --use
33+ docker buildx build -t webdevops/$(PROJECT_NAME ) :development --platform linux/amd64,linux/arm,linux/arm64 --push .
3234
3335.PHONY : test
3436test :
3537 go test ./...
3638
39+ .PHONY : dependencies
40+ dependencies :
41+ go mod vendor
42+
43+ .PHONY : check-release
44+ check-release : vendor lint gosec test
45+
3746.PHONY : lint
3847lint : $(GOLANGCI_LINT_BIN )
39- $(GOLANGCI_LINT_BIN ) run -E exportloopref,gofmt --timeout=10m
48+ $(GOLANGCI_LINT_BIN ) run -E exportloopref,gofmt --timeout=30m
4049
41- .PHONY : dependencies
42- dependencies : $(GOLANGCI_LINT_BIN )
50+ .PHONY : gosec
51+ gosec : $(GOSEC_BIN )
52+ $(GOSEC_BIN ) ./...
4353
4454$(GOLANGCI_LINT_BIN ) :
45- curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(FIRST_GOPATH ) /bin v1.32.2
55+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(FIRST_GOPATH ) /bin
56+
57+ $(GOSEC_BIN ) :
58+ curl -sfL https://raw.githubusercontent.com/securego/gosec/master/install.sh | sh -s -- -b $(FIRST_GOPATH ) /bin
0 commit comments