-
-
Notifications
You must be signed in to change notification settings - Fork 588
fix: support gazelle generation_mode:update_only #2708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
gazelle/pythonconfig/pythonconfig.go
Outdated
@@ -134,12 +134,20 @@ type Configs map[string]*Config | |||
|
|||
// ParentForPackage returns the parent Config for the given Bazel package. | |||
func (c *Configs) ParentForPackage(pkg string) *Config { |
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.
Since map
is a reference type, could you please update the receiver arg to be a type of c Configs
please?
func (c *Configs) ParentForPackage(pkg string) *Config { | |
func (c Configs) ParentForPackage(pkg string) *Config { |
if dir == "" { | ||
return nil | ||
} | ||
pkg = dir |
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.
Could you add a unit test for this new logic? Just testing the Configs
in isolation would be sufficient.
Right now it is a little bit hard to read and having tests would help understand what this has to do.
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've added a few basic tests for this method.
There should probably be some additional full tests for update_only
and mixing that with the different python_generation_mode
modes but I'm not familiar enough with it to do in this initial PR.
552417e
to
956cff8
Compare
956cff8
to
3410bf2
Compare
@@ -125,21 +125,28 @@ const ( | |||
|
|||
// defaultIgnoreFiles is the list of default values used in the | |||
// python_ignore_files option. | |||
var defaultIgnoreFiles = map[string]struct{}{ | |||
} | |||
var defaultIgnoreFiles = map[string]struct{}{} |
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.
The precommit seems to be doing 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.
Thank you for the extra tests!
This just fixes a crash when
generation_mode: update_only
causesGenerateRules
to not be invoked for 100% of directories.Fix #2707