Skip to content

Commit

Permalink
Updated linter version and make cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Apr 24, 2024
1 parent 3888731 commit ddffa93
Showing 1 changed file with 25 additions and 13 deletions.
38 changes: 25 additions & 13 deletions .make/go.mk
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,31 @@ install-go: ## Install the application (Using Native Go)

.PHONY: lint
lint: ## Run the golangci-lint application (install if not found)
@echo "installing golangci-lint..."
@#Travis (has sudo)
@if [ "$(shell command -v golangci-lint)" = "" ] && [ $(TRAVIS) ]; then curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.54.0 && sudo cp ./bin/golangci-lint $(go env GOPATH)/bin/; fi;
@#AWS CodePipeline
@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.54.0; fi;
@#GitHub Actions
@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.54.0; fi;
@#Brew - MacOS
@if [ "$(shell command -v golangci-lint)" = "" ] && [ "$(shell command -v brew)" != "" ]; then brew install golangci-lint; fi;
@#MacOS Vanilla
@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.54.0; fi;
@echo "running golangci-lint..."
@golangci-lint run --verbose
@if [ "$(shell which golangci-lint)" = "" ]; then \
if [ "$(shell command -v brew)" != "" ]; then \
echo "Brew detected, attempting to install golangci-lint..."; \
if ! brew list golangci-lint &>/dev/null; then \
brew install golangci-lint; \
else \
echo "golangci-lint is already installed via brew."; \
fi; \
else \
echo "Installing golangci-lint via curl..."; \
GOPATH=$$(go env GOPATH); \
if [ -z "$$GOPATH" ]; then GOPATH=$$HOME/go; fi; \
echo "Installation path: $$GOPATH/bin"; \
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $$GOPATH/bin v1.57.2; \
fi; \
fi; \
if [ "$(TRAVIS)" != "" ]; then \
echo "Travis CI environment detected."; \
elif [ "$(CODEBUILD_BUILD_ID)" != "" ]; then \
echo "AWS CodePipeline environment detected."; \
elif [ "$(GITHUB_WORKFLOW)" != "" ]; then \
echo "GitHub Actions environment detected."; \
fi; \
echo "Running golangci-lint..."; \
golangci-lint run --verbose

.PHONY: test
test: ## Runs lint and ALL tests
Expand Down

0 comments on commit ddffa93

Please sign in to comment.