33
44# Project setup
55BINARY_NAME =tredctl
6+ MAINTAINERS ='Ben Cessa <ben@pixative.com>'
67
78# State values
89GIT_COMMIT_DATE =$(shell TZ=UTC git log -n1 --pretty=format:'% cd' --date='format-local:% Y-% m-% dT% H:% M:% SZ')
910GIT_COMMIT_HASH =$(shell git log -n1 --pretty=format:'% H')
10- GIT_TAG =$(shell git describe --abbrev=0 --match='v * ' --always | cut -c 1-8)
11+ GIT_TAG =$(shell git describe --tags --always --abbrev=0 | cut -c 1-8)
1112
1213# Linker tags
1314# https://golang.org/cmd/link/
@@ -21,15 +22,16 @@ help:
2122 @echo " Commands available"
2223 @sed -n ' s/^##//p' ${MAKEFILE_LIST} | column -t -s ' :' | sed -e ' s/^/ /' | sort
2324
24- # # updates: List available updates for direct dependencies
25- updates :
26- # https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies
27- go list -u -f ' {{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all 2> /dev/null
25+ # # build: Build for the default architecture in use
26+ build :
27+ go build -v -ldflags ' $(LD_FLAGS)' -o $(BINARY_NAME )
2828
29- # # scan: Look for known vulnerabilities in the project dependencies
30- # https://github.com/sonatype-nexus-community/nancy
31- scan :
32- @nancy -quiet go.sum
29+ # # build-for: Build the available binaries for the specified 'os' and 'arch'
30+ # make build-for os=linux arch=amd64
31+ build-for :
32+ CGO_ENABLED=0 GOOS=$(os ) GOARCH=$(arch ) \
33+ go build -v -ldflags ' $(LD_FLAGS)' \
34+ -o $(BINARY_NAME ) _$(os ) _$(arch )$(suffix )
3335
3436# # clean: Verify dependencies and remove intermediary products
3537clean :
@@ -38,29 +40,29 @@ clean:
3840 go mod tidy
3941 go mod verify
4042
43+ # # install: Install the binary to '$GOPATH/bin'
44+ install :
45+ go build -v -ldflags ' $(LD_FLAGS)' -i -o ${GOPATH} /bin/$(BINARY_NAME )
46+
4147# # lint: Static analysis
4248lint :
4349 golangci-lint run -v ./...
4450
51+ # # release: Prepare the artifacts for a new tagged release
52+ release :
53+ goreleaser release --skip-validate --skip-publish --rm-dist
54+
55+ # # scan: Look for known vulnerabilities in the project dependencies
56+ # https://github.com/sonatype-nexus-community/nancy
57+ scan :
58+ @nancy -quiet go.sum
59+
4560# # test: Run unit tests excluding the vendor dependencies
4661test :
4762 go test -v -race -failfast -coverprofile=coverage.report ./...
4863 go tool cover -html coverage.report -o coverage.html
4964
50- # # build: Build for the default architecture in use
51- build :
52- go build -v -ldflags ' $(LD_FLAGS)' -o $(BINARY_NAME )
53-
54- # # install: Install the binary to '$GOPATH/bin'
55- install :
56- go build -v -ldflags ' $(LD_FLAGS)' -i -o ${GOPATH} /bin/$(BINARY_NAME )
57-
58- # # build-for: Build the available binaries for the specified 'os' and 'arch'
59- build-for :
60- CGO_ENABLED=0 GOOS=$(os ) GOARCH=$(arch ) \
61- go build -v -ldflags ' $(LD_FLAGS)' \
62- -o $(BINARY_NAME ) _$(os ) _$(arch )$(suffix )
63-
64- # # release: Prepare the artifacts for a new tagged release
65- release :
66- goreleaser release --skip-validate --skip-publish --rm-dist
65+ # # updates: List available updates for direct dependencies
66+ updates :
67+ # https://github.com/golang/go/wiki/Modules#how-to-upgrade-and-downgrade-dependencies
68+ go list -u -f ' {{if (and (not (or .Main .Indirect)) .Update)}}{{.Path}}: {{.Version}} -> {{.Update.Version}}{{end}}' -m all 2> /dev/null
0 commit comments