Conversation
A plain "go build ./..." or "go mod tidy" fails in this repo for two reasons: - warn/docs imports github.com/bazelbuild/buildtools/warn/docs/proto, which only exists as a go_proto_library generated at build time by Bazel. Every other proto in the repo (api_proto, build_proto, deps_proto, extra_actions_base_proto) has its generated .pb.go checked in with a go_proto_checkedin_test freshness check; this one never got the same treatment. - go.mod is missing the go 1.21 requirement and the indirect golang.org/x/sys dependency introduced by the github.com/google/safeopen dependency (bazel-contrib#1491). Bazel builds resolve dependencies through MODULE.bazel, so CI did not catch this, but it also breaks "go install github.com/bazelbuild/buildtools/buildifier@latest". Move docs.proto into warn/docs/proto to match the layout of the other proto packages, check in docs.gen.pb.go, add the freshness check test to //:tests, and run "go mod tidy" to repair go.mod and go.sum. Update with: bazel run //warn/docs/proto:docs.gen.pb.go_copy
Member
|
Could you add a BazelCI job that verifies that |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A plain
go build ./...orgo mod tidycurrently fails in this repo for two reasons:warn/docsimportsgithub.com/bazelbuild/buildtools/warn/docs/proto, which only exists as ago_proto_librarygenerated at build time by Bazel. Every other proto in the repo (api_proto, build_proto, deps_proto, extra_actions_base_proto) has its generated.pb.gochecked in with ago_proto_checkedin_testfreshness check, so I figured it's fine to add this missing one.go.modis missing thego 1.21requirement and the indirectgolang.org/x/sysdependency introduced by thegithub.com/google/safeopendependency (Prevent unwanted path traversal in file writes from buildtools. #1491). I think we forgot to rungo mod tidyin that PR and Bazel CI didn't catch it, because building the code with Bazel works even whengo.modis not correct. This causedgo install github.com/bazelbuild/buildtools/buildifier@latestto break, which is documented in the README as a valid way to install buildifier.This PR:
docs.protointowarn/docs/proto/to match the layout of the other proto packages,docs.gen.pb.goand adds its freshness check to//:tests, so it cannot silently go stale (update withbazel run //warn/docs/proto:docs.gen.pb.go_copy),go mod tidyto repairgo.modandgo.sum.After this,
go build ./...,go mod tidy, andgo install ...@latestwork fine again alongside the Bazel build. ❤️