@@ -13,27 +13,33 @@ DARWIN=$(BINARY_NAME)-darwin
1313LINUX =$(BINARY_NAME ) -linux
1414WINDOWS =$(BINARY_NAME ) -windows.exe
1515
16+ # # Define the binary name
17+ TAGS =
18+ ifdef GO_BUILD_TAGS
19+ override TAGS=-tags $(GO_BUILD_TAGS)
20+ endif
21+
1622.PHONY : test lint vet install generate
1723
1824bench : # # Run all benchmarks in the Go application
1925 @echo " running benchmarks..."
20- @go test -bench=. -benchmem
26+ @go test -bench=. -benchmem $( TAGS )
2127
2228build-go : # # Build the Go application (locally)
2329 @echo " building go app..."
24- @go build -o bin/$(BINARY_NAME )
30+ @go build -o bin/$(BINARY_NAME ) $( TAGS )
2531
2632clean-mods : # # Remove all the Go mod cache
2733 @echo " cleaning mods..."
2834 @go clean -modcache
2935
3036coverage : # # Shows the test coverage
3137 @echo " creating coverage report..."
32- @go test -coverprofile=coverage.out ./... && go tool cover -func=coverage.out
38+ @go test -coverprofile=coverage.out ./... $( TAGS ) && go tool cover -func=coverage.out $( TAGS )
3339
3440generate : # # Runs the go generate command in the base of the repo
3541 @echo " generating files..."
36- @go generate -v
42+ @go generate -v $( TAGS )
3743
3844godocs : # # Sync the latest tag with GoDocs
3945 @echo " syndicating to GoDocs..."
@@ -45,59 +51,59 @@ godocs: ## Sync the latest tag with GoDocs
4551
4652install : # # Install the application
4753 @echo " installing binary..."
48- @go build -o $$ GOPATH/bin/$(BINARY_NAME )
54+ @go build -o $$ GOPATH/bin/$(BINARY_NAME ) $( TAGS )
4955
5056install-go : # # Install the application (Using Native Go)
5157 @echo " installing package..."
52- @go install $(GIT_DOMAIN ) /$(REPO_OWNER ) /$(REPO_NAME )
58+ @go install $(GIT_DOMAIN ) /$(REPO_OWNER ) /$(REPO_NAME ) $( TAGS )
5359
5460lint : # # Run the golangci-lint application (install if not found)
5561 @echo " installing golangci-lint..."
5662 @# Travis (has sudo)
57- @if [ " $( shell command -v golangci-lint) " = " " ] && [ $( TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.42.1 && sudo cp ./bin/golangci-lint $(go env GOPATH ) /bin/; fi ;
63+ @if [ " $( shell command -v golangci-lint) " = " " ] && [ $( TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.44.0 && sudo cp ./bin/golangci-lint $(go env GOPATH ) /bin/; fi ;
5864 @# AWS CodePipeline
59- @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( CODEBUILD_BUILD_ID) " != " " ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH ) /bin v1.42.1 ; fi ;
65+ @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( CODEBUILD_BUILD_ID) " != " " ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH ) /bin v1.44.0 ; fi ;
6066 @# Github Actions
61- @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( GITHUB_WORKFLOW) " != " " ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH ) /bin v1.42.1 ; fi ;
67+ @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( GITHUB_WORKFLOW) " != " " ]; then curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sudo sh -s -- -b $(go env GOPATH ) /bin v1.44.0 ; fi ;
6268 @# Brew - MacOS
6369 @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( shell command -v brew) " != " " ]; then brew install golangci-lint; fi ;
6470 @# MacOS Vanilla
65- @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( shell command -v brew) " != " " ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.42.1 ; fi ;
71+ @if [ " $( shell command -v golangci-lint) " = " " ] && [ " $( shell command -v brew) " != " " ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- v1.44.0 ; fi ;
6672 @echo " running golangci-lint..."
6773 @golangci-lint run --verbose
6874
6975test : # # Runs lint and ALL tests
7076 @$(MAKE ) lint
7177 @echo " running tests..."
72- @go test ./... -v
78+ @go test ./... -v $( TAGS )
7379
7480test-unit : # # Runs tests and outputs coverage
7581 @echo " running unit tests..."
76- @go test ./... -race -coverprofile=coverage.txt -covermode=atomic
82+ @go test ./... -race -coverprofile=coverage.txt -covermode=atomic $( TAGS )
7783
7884test-short : # # Runs vet, lint and tests (excludes integration tests)
7985 @$(MAKE ) lint
8086 @echo " running tests (short)..."
81- @go test ./... -v -test.short
87+ @go test ./... -v -test.short $( TAGS )
8288
8389test-ci : # # Runs all tests via CI (exports coverage)
8490 @$(MAKE ) lint
8591 @echo " running tests (CI)..."
86- @go test ./... -race -coverprofile=coverage.txt -covermode=atomic
92+ @go test ./... -race -coverprofile=coverage.txt -covermode=atomic $( TAGS )
8793
8894test-ci-no-race : # # Runs all tests via CI (no race) (exports coverage)
8995 @$(MAKE ) lint
9096 @echo " running tests (CI - no race)..."
91- @go test ./... -coverprofile=coverage.txt -covermode=atomic
97+ @go test ./... -coverprofile=coverage.txt -covermode=atomic $( TAGS )
9298
9399test-ci-short : # # Runs unit tests via CI (exports coverage)
94100 @$(MAKE ) lint
95101 @echo " running tests (CI - unit tests only)..."
96- @go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic
102+ @go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic $( TAGS )
97103
98104test-no-lint : # # Runs just tests
99105 @echo " running tests..."
100- @go test ./... -v
106+ @go test ./... -v $( TAGS )
101107
102108uninstall : # # Uninstall the application (and remove files)
103109 @echo " uninstalling go application..."
@@ -119,4 +125,4 @@ update-linter: ## Update the golangci-lint package (macOS only)
119125
120126vet : # # Run the Go vet application
121127 @echo " running go vet..."
122- @go vet -v ./...
128+ @go vet -v ./... $( TAGS )
0 commit comments