Skip to content

Commit 6cb9b89

Browse files
authored
fix(internal/godocfx): prevent errors for filtered mods (#5485)
1 parent c6158ca commit 6cb9b89

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

internal/godocfx/main.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,18 @@ func runCmd(dir, name string, args ...string) error {
148148
}
149149

150150
func process(mod indexEntry, workingDir, outDir string, print bool) error {
151+
filter := []string{
152+
"cloud.google.com/go/analytics",
153+
"cloud.google.com/go/area120",
154+
"cloud.google.com/go/gsuiteaddons",
155+
156+
"google.golang.org/appengine/v2/cmd",
157+
}
158+
if hasPrefix(mod.Path, filter) {
159+
log.Printf("%q filtered out, nothing to do: here is the filter: %q", mod.Path, filter)
160+
return nil
161+
}
162+
151163
// Be sure to get the module and run the module loader in the tempDir.
152164
if err := runCmd(workingDir, "go", "mod", "tidy"); err != nil {
153165
return fmt.Errorf("go mod tidy error: %v", err)
@@ -159,13 +171,6 @@ func process(mod indexEntry, workingDir, outDir string, print bool) error {
159171

160172
log.Println("Starting to parse")
161173
optionalExtraFiles := []string{}
162-
filter := []string{
163-
"cloud.google.com/go/analytics",
164-
"cloud.google.com/go/area120",
165-
"cloud.google.com/go/gsuiteaddons",
166-
167-
"google.golang.org/appengine/v2/cmd",
168-
}
169174
r, err := parse(mod.Path+"/...", workingDir, optionalExtraFiles, filter)
170175
if err != nil {
171176
return fmt.Errorf("parse: %v", err)

0 commit comments

Comments
 (0)