Created
October 7, 2021 08:51
-
-
Save Loupax/0c80cb8c3256f18875f9da8c9789c82c to your computer and use it in GitHub Desktop.
Automatically reviews all changed files of a go project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function review_go_branch(){ | |
compareAgainst="$1" | |
if [ -z "$compareAgainst" ] | |
then | |
compareAgainst="origin/master" | |
fi | |
files=($(git diff --name-status --diff-filter=ACM $compareAgainst | awk '{print $2}')) | |
if [ -z "$files" ] | |
then | |
return 0 | |
fi | |
grepFiles=$(printf "\|^%s" "${files[@]}") | |
grepFiles=${grepFiles:2} | |
golangci-lint run ./... --out-format tab --config ~/.golangci.yaml | grep $grepFiles | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment