fix: support gazelle generation_mode:update_only#2708
fix: support gazelle generation_mode:update_only#2708aignas merged 1 commit intobazel-contrib:mainfrom
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.
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.
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.
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
| // python_ignore_files option. | ||
| var defaultIgnoreFiles = map[string]struct{}{ | ||
| } | ||
| var defaultIgnoreFiles = map[string]struct{}{} |
There was a problem hiding this comment.
The precommit seems to be doing this? 🤷
aignas
left a comment
There was a problem hiding this comment.
Thank you for the extra tests!
This just fixes a crash when
generation_mode: update_onlycausesGenerateRulesto not be invoked for 100% of directories.Fix #2707