Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: pass argument to linter script #15592

Merged
merged 4 commits into from
Mar 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore: pass argument to linter script
  • Loading branch information
julienrbrt committed Mar 29, 2023
commit 970a8503e51801138630d493076880718541a39a
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,12 @@ lint:
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@sh ./scripts/go-lint-all.sh

.PHONY: lint
lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@sh ./scripts/go-lint-all.sh --fix

.PHONY: lint lint-fix

###############################################################################
### Protobuf ###
Expand Down
6 changes: 4 additions & 2 deletions scripts/go-lint-all.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash

set -eu
set -e

args=("$@")

export pwd=$(pwd)

for modfile in $(find . -name go.mod); do
echo "linting $(dirname $modfile)"
DIR=$(dirname $modfile)
(cd $DIR; golangci-lint run ./... --fix -c $pwd/.golangci.yml)
(cd $DIR; golangci-lint run ./... -c $pwd/.golangci.yml $args)
done