summaryrefslogtreecommitdiff
diff options
-rwxr-xr-xrun-checks19
1 files changed, 16 insertions, 3 deletions
diff --git a/run-checks b/run-checks
index 5fb916e853..eb90df3f3b 100755
--- a/run-checks
+++ b/run-checks
@@ -71,6 +71,19 @@ addtrap() {
trap "store_exit_code; $CURRENTTRAP ; exit_with_exit_code" EXIT
}
+goinstall() {
+ pkg="$1"
+ # go1.18+ will no longer build/install packages. Here "go install"
+ # must be used but it will only fetch remote packages if the @latest
+ # (or similar syntax is used). Instead of checking the version we
+ # check if the "go install" help mentions this new feature.
+ if go help install | grep -q @latest; then
+ go install "${pkg}"@latest
+ else
+ go get -u "${pkg}"
+ fi
+}
+
endmsg() {
if [ $EXIT_CODE -eq 0 ]; then
p="success.txt"
@@ -210,7 +223,7 @@ if [ "$STATIC" = 1 ]; then
echo "Checking spelling errors"
if ! command -v misspell >/dev/null; then
- go get -u github.com/client9/misspell/cmd/misspell
+ goinstall github.com/client9/misspell/cmd/misspell
fi
# FIXME: auter is only misspelled in the changelog so we should fix there
# PROCES is used in the seccomp tests (PRIO_PROCES{,S,SS})
@@ -222,7 +235,7 @@ if [ "$STATIC" = 1 ]; then
if dpkg --compare-versions "$(go version | awk '$3 ~ /^go[0-9]/ {print substr($3, 3)}')" ge 1.12; then
echo "Checking for ineffective assignments"
if ! command -v ineffassign >/dev/null; then
- go get -u github.com/gordonklaus/ineffassign
+ goinstall github.com/gordonklaus/ineffassign
fi
# ineffassign knows about ignoring vendor/ \o/
ineffassign ./...
@@ -230,7 +243,7 @@ if [ "$STATIC" = 1 ]; then
echo "Checking for naked returns"
if ! command -v nakedret >/dev/null; then
- go get -u github.com/alexkohler/nakedret
+ goinstall github.com/alexkohler/nakedret
fi
got=$(go list ./... | grep -v '/osutil/udev/' | grep -v '/vendor/' | xargs nakedret 2>&1)
if [ -n "$got" ]; then