bazelbuild / rules_go

Go rules for Bazel
Apache License 2.0
1.35k stars 635 forks source link

Automatically run `bazel mod tidy` in `@rules_go//go` #3927

Closed fmeum closed 2 weeks ago

fmeum commented 2 months ago

What type of PR is this?

Feature

What does this PR do? Why is it needed?

bazel mod tidy is run if supported and if relevant files change due to the command.

Which issues(s) does this PR fix?

Fixes #3900 Fixes https://github.com/bazelbuild/bazel-gazelle/issues/1749

Other notes for review

stefanpenner commented 1 month ago

Just checking, will this also work for users of go.work workspaces?

fmeum commented 1 month ago

Just checking, will this also work for users of go.work workspaces?

This requires adding the relevant files to https://github.com/bazelbuild/bazel-gazelle/blob/7c84c339075a992ea1a6f720899d91c0e047efe2/internal/bzlmod/go_deps.bzl#L657. Maybe that already happens with the fake go.mod files we create for a workspace?