Skip to content
This repository was archived by the owner on Mar 12, 2025. It is now read-only.
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