From 567c939ac43f018c7877a57e8eb956b085e5c663 Mon Sep 17 00:00:00 2001 From: Rob Lee Date: Sat, 11 Dec 2021 16:09:03 +0000 Subject: [PATCH] Finish Removing `golint` (#1746) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Set GO111MODULE to auto in golint script– #1743 As mentioned in #1743 the Go modules environment flag is set to `off` in the script which appears to cause a warning message for each module of the codebase that it is "not in GOROOT". Set to `auto` as this allows the same build to be run the original way should someone choose to delete the `go.mod` file from the project root. * Remove redundant code – golint script Go 1.17 ignores `GO111MODULE` and there are no directories in the project root called `mock`. * Replace `golint` with `go vet` `golint` is deprecated (and frozen) replace with the current `go vet`. This reported one issue on `main` branch: ```pkg/stash/with_etcd.go:33:28: loop variable ep captured by func literal``` Fixed loop variable capture with extraction to parameterised anonymous function passed loop variable and passed in to `errgroup.Go` call. * Finish Removing `golint` Removed remaining references to `golint` in dev doc, Makefile, bash scripts, and powershell build scripts. Removed `get_dev_tools.sh` and `get_dev_tools.ps1` as they only install the removed `golint` package. --- DEVELOPMENT.md | 4 ++-- Makefile | 1 - docs/content/contributing/new/development.md | 4 ++-- init.ps1 | 3 +-- scripts/check_govet.sh | 2 +- scripts/get_dev_tools.sh | 7 ------- scripts/ps/{check_golint.ps1 => check_govet.ps1} | 4 ++-- scripts/ps/get_dev_tools.ps1 | 4 ---- 8 files changed, 8 insertions(+), 21 deletions(-) delete mode 100755 scripts/get_dev_tools.sh rename scripts/ps/{check_golint.ps1 => check_govet.ps1} (53%) delete mode 100755 scripts/ps/get_dev_tools.ps1 diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index e863cf2b..88ea1e2e 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -234,10 +234,10 @@ Then open [http://localhost:1313](http://localhost:1313/). # Linting -In our CI/CD pass, we use golint, so feel free to install and run it locally beforehand: +In our CI/CD pass, we use govet, so feel free to run it locally beforehand: ``` -go get golang.org/x/lint/golint +go vet ./... ``` # For People Doing a Release diff --git a/Makefile b/Makefile index 9370f737..95b10548 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,6 @@ docs: ## build the docs docker image .PHONY: setup-dev-env setup-dev-env: - ./scripts/get_dev_tools.sh $(MAKE) dev .PHONY: verify diff --git a/docs/content/contributing/new/development.md b/docs/content/contributing/new/development.md index ffe223f9..13abf5de 100644 --- a/docs/content/contributing/new/development.md +++ b/docs/content/contributing/new/development.md @@ -85,8 +85,8 @@ Then open [http://localhost:1313](http://localhost:1313/). # Linting -In our CI/CD pass, we use golint, so feel free to install and run it locally beforehand: +In our CI/CD pass, we use govet, so feel free to run it locally beforehand: ``` -go get golang.org/x/lint/golint +go vet ./... ``` diff --git a/init.ps1 b/init.ps1 index 337fbc5a..6ff89a31 100644 --- a/init.ps1 +++ b/init.ps1 @@ -52,7 +52,6 @@ function execScript($name) { } if ($setup_dev_env.IsPresent) { - execScript "get_dev_tools.ps1" & docker-compose -p athensdev up -d mongo } @@ -81,7 +80,7 @@ if ($docs.IsPresent) { if ($verify.IsPresent) { execScript "check_gofmt.ps1" - execScript "check_golint.ps1" + execScript "check_govet.ps1" execScript "check_deps.ps1" } diff --git a/scripts/check_govet.sh b/scripts/check_govet.sh index 4f139895..e6a8a484 100755 --- a/scripts/check_govet.sh +++ b/scripts/check_govet.sh @@ -1,6 +1,6 @@ #!/bin/bash -# check_golint.sh +# check_govet.sh # Run the linter on everything except generated code set -euo pipefail diff --git a/scripts/get_dev_tools.sh b/scripts/get_dev_tools.sh deleted file mode 100755 index 40d312a5..00000000 --- a/scripts/get_dev_tools.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# install_dev_deps.sh -# Ensure that the tools needed to build locally are present -set -xeuo pipefail - -GO111MODULE=off go get golang.org/x/lint/golint diff --git a/scripts/ps/check_golint.ps1 b/scripts/ps/check_govet.ps1 similarity index 53% rename from scripts/ps/check_golint.ps1 rename to scripts/ps/check_govet.ps1 index 59762f12..8e61f452 100755 --- a/scripts/ps/check_golint.ps1 +++ b/scripts/ps/check_govet.ps1 @@ -1,7 +1,7 @@ -# check_golint.ps1 +# check_govet.ps1 # Run the linter on everything -$out = & golint -set_exit_status $(& go list ./...) +$out = & go vet ./... if ($LastExitCode -ne 0) { Write-Error $out } diff --git a/scripts/ps/get_dev_tools.ps1 b/scripts/ps/get_dev_tools.ps1 deleted file mode 100755 index 6e129536..00000000 --- a/scripts/ps/get_dev_tools.ps1 +++ /dev/null @@ -1,4 +0,0 @@ -# install_dev_deps.ps1 -# Ensure that the tools needed to build locally are present - -& go get github.com/golang/lint/golint