From 32c5dfd7e826c3943817fceda274bd68cc375eac Mon Sep 17 00:00:00 2001 From: George Blue Date: Thu, 13 Feb 2025 12:25:46 +0000 Subject: [PATCH] chore: use Go 1.24 tool for staticcheck and goimports --- Makefile | 6 +++--- go.mod | 10 +++++++--- tools/tools.go | 2 -- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3a7704521..60a44b39b 100644 --- a/Makefile +++ b/Makefile @@ -107,7 +107,7 @@ checkformat: ## Checks that the code is formatted correctly fi checkimports: ## Checks that imports are formatted correctly - @@if [ -n "$$(go run golang.org/x/tools/cmd/goimports -l -d .)" ]; then \ + @@if [ -n "$$(go tool goimports -l -d .)" ]; then \ echo "goimports check failed: run 'make format'"; \ exit 1; \ fi @@ -116,14 +116,14 @@ vet: ## Runs go vet go vet ./... staticcheck: ## Runs staticcheck - go list ./... | grep -v 'fakes$$' | xargs go run honnef.co/go/tools/cmd/staticcheck + go list ./... | grep -v 'fakes$$' | xargs go tool staticcheck ###### Format ################################################################# .PHONY: format format: ## format the source gofmt -s -e -l -w . - go run golang.org/x/tools/cmd/goimports -l -w . + go tool goimports -l -w . ###### Image ################################################################## diff --git a/go.mod b/go.mod index 134997cfe..429b26dba 100644 --- a/go.mod +++ b/go.mod @@ -28,12 +28,10 @@ require ( github.com/zclconf/go-cty v1.16.2 golang.org/x/crypto v0.33.0 golang.org/x/net v0.35.0 - golang.org/x/tools v0.30.0 gopkg.in/yaml.v3 v3.0.1 gorm.io/driver/mysql v1.5.7 gorm.io/driver/sqlite v1.5.7 gorm.io/gorm v1.25.12 - honnef.co/go/tools v0.6.0 ) require ( @@ -132,6 +130,7 @@ require ( golang.org/x/sys v0.30.0 // indirect golang.org/x/text v0.22.0 // indirect golang.org/x/time v0.9.0 // indirect + golang.org/x/tools v0.30.0 // indirect google.golang.org/api v0.219.0 // indirect google.golang.org/genproto v0.0.0-20250127172529-29210b9bc287 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20250127172529-29210b9bc287 // indirect @@ -140,7 +139,12 @@ require ( google.golang.org/protobuf v1.36.4 // indirect gopkg.in/DATA-DOG/go-sqlmock.v1 v1.3.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect + honnef.co/go/tools v0.6.0 // indirect rsc.io/goversion v1.2.0 // indirect ) -tool github.com/onsi/ginkgo/v2/ginkgo +tool ( + github.com/onsi/ginkgo/v2/ginkgo + golang.org/x/tools/cmd/goimports + honnef.co/go/tools/cmd/staticcheck +) diff --git a/tools/tools.go b/tools/tools.go index 9d21e30ae..be0cfb0b9 100644 --- a/tools/tools.go +++ b/tools/tools.go @@ -6,8 +6,6 @@ package tools import ( _ "github.com/google/gops" _ "github.com/maxbrunsfeld/counterfeiter/v6" - _ "golang.org/x/tools/cmd/goimports" - _ "honnef.co/go/tools/cmd/staticcheck" ) // This file imports packages that are used when running go generate, or used