From 08b212a4e305b616aff6b6dc483982de98df8cf6 Mon Sep 17 00:00:00 2001 From: Ben Segall Date: Tue, 9 Jul 2024 18:43:00 +0000 Subject: [PATCH] Update golang.org/x/tools to v0.18.0 to gazelle's hardcoded version Gazelle hardcodes a minimum golang.org/x/tools version in their MODULE.bazel https://github.com/bazelbuild/bazel-gazelle/blob/master/MODULE.bazel\#L37 We should ensure we depend on at least that version Test: Bazel stops complaining about mismatched versions Bug: b/303263153 Change-Id: Ie0a12598107254783ed1dcd27a94516e7b182559 GitOrigin-RevId: bcd448cd2555dd04008349bfa65e37fdaeba43a2 --- MODULE.bazel | 7 ------- go.mod | 2 +- go.sum | 4 ++-- tools/BUILD.bazel | 1 + tools/imports.go | 7 ++++--- 5 files changed, 8 insertions(+), 13 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 11d9253a..7a9274a1 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -173,13 +173,6 @@ go_deps.gazelle_override( path = "github.com/googleapis/googleapis", ) -# golang.org/x/tools is not a direct dependency of the go code but is used by nogo -go_deps.module( - path = "golang.org/x/tools", - sum = "h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ=", - version = "v0.18.0", -) - ### All *direct* Go dependencies of the module have to be listed explicitly. use_repo( go_deps, diff --git a/go.mod b/go.mod index 1e2510b8..fe5dffce 100644 --- a/go.mod +++ b/go.mod @@ -30,6 +30,7 @@ require ( golang.org/x/oauth2 v0.20.0 golang.org/x/sync v0.6.0 golang.org/x/sys v0.21.0 + golang.org/x/tools v0.18.0 google.golang.org/api v0.139.0 google.golang.org/genproto v0.0.0-20230803162519-f966b187b2e5 google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d @@ -78,7 +79,6 @@ require ( golang.org/x/crypto v0.21.0 // indirect golang.org/x/net v0.23.0 // indirect golang.org/x/text v0.14.0 // indirect - golang.org/x/tools v0.15.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20230803162519-f966b187b2e5 // indirect diff --git a/go.sum b/go.sum index 76318c83..005d2cba 100644 --- a/go.sum +++ b/go.sum @@ -1606,8 +1606,8 @@ golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= -golang.org/x/tools v0.15.0 h1:zdAyfUGbYmuVokhzVmghFl2ZJh5QhcfebBgmVPFYA+8= -golang.org/x/tools v0.15.0/go.mod h1:hpksKq4dtpQWS1uQ61JkdqWM3LscIS6Slf+VVkm+wQk= +golang.org/x/tools v0.18.0 h1:k8NLag8AGHnn+PHbl7g43CtqZAwG60vZkLqgyZgIHgQ= +golang.org/x/tools v0.18.0/go.mod h1:GL7B4CwcLLeo59yx/9UWWuNOW1n3VZ4f5axWfML7Lcg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= diff --git a/tools/BUILD.bazel b/tools/BUILD.bazel index 8ee2fa19..a8b0da05 100644 --- a/tools/BUILD.bazel +++ b/tools/BUILD.bazel @@ -77,5 +77,6 @@ go_library( "@com_github_pkg_xattr//:xattr", "@com_google_cloud_go_monitoring//apiv3", "@com_google_cloud_go_storage//:storage", + "@org_golang_x_tools//go/analysis", ], ) diff --git a/tools/imports.go b/tools/imports.go index 0f91282b..aff7bb8b 100644 --- a/tools/imports.go +++ b/tools/imports.go @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Define all imports that are only in non-exported code so that -// go.mod and go.sum remain consistent - package tools import ( + // Dependencies of non-exported code, specified here so that + // go.mod and go.sum remain consistent _ "cloud.google.com/go/monitoring/apiv3" _ "cloud.google.com/go/storage" _ "github.com/pkg/xattr" + + _ "golang.org/x/tools/go/analysis" // Used as tools by bazel nogo analyzers )