Fix goimports installation in workhorse Makefile

What does this MR do and why?

A dependency update workhorse: Update gRPC dependencies (!211742 - merged) has a failing pipeline where go install golang.org/x/tools/cmd/goimports fails with the following error:

../.go/pkg/mod/golang.org/x/tools@v0.37.0/cmd/goimports/goimports.go:23:2: missing go.sum entry for module providing package golang.org/x/telemetry/counter (imported by golang.org/x/tools/cmd/goimports); to add:
	go get golang.org/x/tools/cmd/goimports@v0.37.0

Issue: go install golang.org/x/tools/cmd/goimports without a version suffix tries to resolve dependencies from the project's go.mod. Since goimports isn't a project dependency, its transitive dependencies (like golang.org/x/telemetry/counter) aren't in go.sum, causing the install to fail.

Solution: Add a version suffix to the install command. This tells Go to fetch the tool and its dependencies independently, without relying on the project's module files. We similarly pin the version for the staticcheck install above on line 189.

References

workhorse: Update gRPC dependencies (!211742 - merged)

Screenshots or screen recordings

Before After

How to set up and validate locally

  1. Apply the following dependency update: go get google.golang.org/grpc@v1.78.0
  2. go mod tidy
  3. make install-goimports succeeds

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Fred Reinink

Merge request reports

Loading