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

another option for fixing the go vet script #63

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
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
5 changes: 3 additions & 2 deletions run-go-vet.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env bash

set -e
pkg=$(go list)
for dir in $(echo $@|xargs -n1 dirname|sort -u); do
go vet $pkg/$dir
for fn in "$@"; do
go vet "${pkg}/${fn}"
Comment on lines +5 to +6
Copy link
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
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

done