From 6cb9b89b2d654c695eab00d8fb375cce0cd6e059 Mon Sep 17 00:00:00 2001 From: Tyler Bui-Palsulich <26876514+tbpg@users.noreply.github.com> Date: Wed, 9 Feb 2022 11:39:23 -0500 Subject: [PATCH] fix(internal/godocfx): prevent errors for filtered mods (#5485) --- internal/godocfx/main.go | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/internal/godocfx/main.go b/internal/godocfx/main.go index 69d96ec1a37..5e980f8c76b 100644 --- a/internal/godocfx/main.go +++ b/internal/godocfx/main.go @@ -148,6 +148,18 @@ func runCmd(dir, name string, args ...string) error { } func process(mod indexEntry, workingDir, outDir string, print bool) error { + filter := []string{ + "cloud.google.com/go/analytics", + "cloud.google.com/go/area120", + "cloud.google.com/go/gsuiteaddons", + + "google.golang.org/appengine/v2/cmd", + } + if hasPrefix(mod.Path, filter) { + log.Printf("%q filtered out, nothing to do: here is the filter: %q", mod.Path, filter) + return nil + } + // Be sure to get the module and run the module loader in the tempDir. if err := runCmd(workingDir, "go", "mod", "tidy"); err != nil { return fmt.Errorf("go mod tidy error: %v", err) @@ -159,13 +171,6 @@ func process(mod indexEntry, workingDir, outDir string, print bool) error { log.Println("Starting to parse") optionalExtraFiles := []string{} - filter := []string{ - "cloud.google.com/go/analytics", - "cloud.google.com/go/area120", - "cloud.google.com/go/gsuiteaddons", - - "google.golang.org/appengine/v2/cmd", - } r, err := parse(mod.Path+"/...", workingDir, optionalExtraFiles, filter) if err != nil { return fmt.Errorf("parse: %v", err)