build: Run staticcheck with "go run"

Running the tool this way ensures that we'll always run the version
selected by our go.mod file, rather than whatever happened to be available
in $GOPATH/bin on the system where we're running this.

This change caused some contexts to now be using a newer version of
staticcheck with additional checks, and so this commit also includes some
changes to quiet the new warnings without any change in overall behavior.
This commit is contained in:
Martin Atkins 2021-10-12 11:09:00 -07:00
parent d76759a6a9
commit 965c0f3f91
3 changed files with 3 additions and 5 deletions

View File

@ -246,7 +246,7 @@ func TestCidrSubnet(t *testing.T) {
},
{ // fractions are Not Ok
cty.StringVal("10.256.0.0/8"),
cty.NumberFloatVal(2 / 3),
cty.NumberFloatVal(2.0 / 3.0),
cty.NumberFloatVal(.75),
cty.UnknownVal(cty.String),
true,

View File

@ -154,9 +154,7 @@ func ResolvePluginPaths(paths []string) PluginMetaSet {
// Trim the .exe suffix used on Windows before we start wrangling
// the remainder of the path.
if strings.HasSuffix(baseName, ".exe") {
baseName = baseName[:len(baseName)-4]
}
baseName = strings.TrimSuffix(baseName, ".exe")
parts := strings.SplitN(baseName, "_v", 2)
name := parts[0]

View File

@ -13,4 +13,4 @@ packages=$(go list ./... | egrep -v ${skip})
# We are skipping style-related checks, since terraform intentionally breaks
# some of these. The goal here is to find issues that reduce code clarity, or
# may result in bugs.
staticcheck -checks 'all,-ST*' ${packages}
go run honnef.co/go/tools/cmd/staticcheck -checks 'all,-ST*' ${packages}