Skip to content

Commit 4f9768f

Browse files
committed
fix: support generation_mode:update_only
1 parent 09145b9 commit 4f9768f

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

gazelle/pythonconfig/pythonconfig.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,20 @@ type Configs map[string]*Config
134134

135135
// ParentForPackage returns the parent Config for the given Bazel package.
136136
func (c *Configs) ParentForPackage(pkg string) *Config {
137-
dir := path.Dir(pkg)
138-
if dir == "." {
139-
dir = ""
137+
for {
138+
dir := path.Dir(pkg)
139+
if dir == "." {
140+
dir = ""
141+
}
142+
parent := (map[string]*Config)(*c)[dir]
143+
if parent != nil {
144+
return parent
145+
}
146+
if dir == "" {
147+
return nil
148+
}
149+
pkg = dir
140150
}
141-
parent := (map[string]*Config)(*c)[dir]
142-
return parent
143151
}
144152

145153
// Config represents a config extension for a specific Bazel package.

0 commit comments

Comments
 (0)