Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(internal/godocfx): prevent errors for filtered mods #5485

Merged
merged 1 commit into from Feb 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 12 additions & 7 deletions internal/godocfx/main.go
Expand Up @@ -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)
Expand All @@ -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)
Expand Down