-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Conversation
…and copy to source tree
9b43184
to
b851894
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Eager to try it for myself 😊
return map[string]rule.KindInfo{ | ||
"go_mockgen": { | ||
MatchAny: true, | ||
// I cant tell if these work or not... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you need help for these?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might. I couldnt find any docs/explanation on how this is meant to work exactly, and it didnt work the way that I expected it to
@jhchabran theres one other //go:generate that exists, but @burmudar agrees that its probably fine to have that one temporarily not covered by |
go 1.21 | ||
go 1.21.4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Strum355 What motivated this change? I know this is valid now, but not sure why we need to be so specific on the patch version. Noticed this because the version of trivy I am using trips up on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gopls insisted on adding this and a toolchain directive immediately below that I removed, but I may have forgotten to remove this one. Feel free to remove
Adds a new:
for generating go-mockgen mocks & testing for their being up-to-date.
Each go_mockgen macro invocation adds targets for generating mocks, copying to the source tree, as well as testing whether the current source tree mocks are up-to-date.
How to use this:
bazel run //dev:go_mockgen
for the catch-all, orbazel run //some/target:generate_mocks
for an individual package, andbazel test //some/target:generate_mocks_tests
to test for up-to-date-ness. There is no catch-all for testingThis currently uses a fork of go-mockgen, with an open PR for upstream here: derision-test/go-mockgen#50.
TODO: make go generate step local-only in
sg lint
Closes https://github.com/sourcegraph/sourcegraph/issues/60099
Test plan
Extensive testing during development, including the following cases:
srcs
attribute list and then re-runningsg bazel configure
sg bazel configure
The existing config tests a lot of existing paths anyway (creating mocks for a 3rd party library's interface, entries for a given output file in >1 config file etc)