Skip to content

Commit

Permalink
cmd/gazelle: add resolvers for activated languages only
Browse files Browse the repository at this point in the history
This disables processing of rules for languages which are disabled via the -lang
flag. Concretely, this halves the time it takes for Gazelle to update our Go
rules by skipping processing of all closure_js rules.
  • Loading branch information
Rob Figueiredo committed May 19, 2020
1 parent 0da10e2 commit 5b77c67
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions cmd/gazelle/fix-update.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,14 @@ func runFixUpdate(cmd command, args []string) (err error) {
loads := genericLoads
for _, lang := range languages {
cexts = append(cexts, lang)
}

c, err := newFixUpdateConfiguration(cmd, args, cexts)
if err != nil {
return err
}

for _, lang := range filterLanguages(c, languages) {
for kind, info := range lang.Kinds() {
mrslv.AddBuiltin(kind, lang)
kinds[kind] = info
Expand All @@ -253,11 +261,6 @@ func runFixUpdate(cmd command, args []string) (err error) {
}
ruleIndex := resolve.NewRuleIndex(mrslv.Resolver)

c, err := newFixUpdateConfiguration(cmd, args, cexts)
if err != nil {
return err
}

if err := fixRepoFiles(c, loads); err != nil {
return err
}
Expand Down

0 comments on commit 5b77c67

Please sign in to comment.