Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.

another option for fixing the go vet script#63

Open
arschles wants to merge 2 commits intodnephin:masterfrom
arschles:govet2
Open

another option for fixing the go vet script#63
arschles wants to merge 2 commits intodnephin:masterfrom
arschles:govet2

Conversation

@arschles
Copy link
Copy Markdown

alternative to #62, see that PR for context on this one

Comment thread run-go-vet.sh
Comment on lines +5 to +6
for fn in "$@"; do
go vet "${pkg}/${fn}"
Copy link
Copy Markdown
Owner

@dnephin dnephin Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work? go help vet claims it runs against packages not files.

My suggestion here was something like this:

for dir in $(echo $@ | xargs -n1 dirname | sort -u); do
    go vet $(go list ./$dir)
done

Copy link
Copy Markdown
Author

@arschles arschles Oct 27, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, with go 1.13, you can run it against files. Here's a test:

keda on 🌲 http Go 🐹  v1.13.8 go vet main.go

keda on 🌲 http Go 🐹  v1.13.8   echo $?
0

I believe this is possible for later versions as well. Not sure about previous. Unfortunately I don't have time at the moment to go check

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants