mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-24 16:10:46 -06:00
965c0f3f91
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.
17 lines
670 B
Bash
Executable File
17 lines
670 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
echo "==> Checking that code complies with static analysis requirements..."
|
|
# Skip legacy code which is frozen, and can be removed once we can refactor the
|
|
# remote backends to no longer require it.
|
|
skip="internal/legacy|backend/remote-state/"
|
|
|
|
# Skip generated code for protobufs.
|
|
skip=$skip"|internal/planproto|internal/tfplugin5|internal/tfplugin6"
|
|
|
|
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.
|
|
go run honnef.co/go/tools/cmd/staticcheck -checks 'all,-ST*' ${packages}
|