internal/fetch: add logging
Add logging to understand why github.com/CAFxX/decommit@v0.1.1
returns BadModule.
For golang/go#48451
Change-Id: Ibd5e1a75f59d1066e98624ddb3db7756d2d488e8
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/350993
Trust: Jonathan Amsterdam <jba@google.com>
Run-TryBot: Jonathan Amsterdam <jba@google.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Reviewed-by: Jamal Carvalho <jamal@golang.org>
diff --git a/internal/fetch/load.go b/internal/fetch/load.go
index ab3135b..f2a05e0 100644
--- a/internal/fetch/load.go
+++ b/internal/fetch/load.go
@@ -27,6 +27,7 @@
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
"golang.org/x/pkgsite/internal/godoc"
+ "golang.org/x/pkgsite/internal/log"
"golang.org/x/pkgsite/internal/source"
"golang.org/x/pkgsite/internal/stdlib"
)
@@ -84,6 +85,7 @@
if err != nil {
return nil, err
}
+ log.Debugf(ctx, "got %d matching files for build context %s", len(mfiles), bc)
filesKey := mapKeyForFiles(mfiles)
if doc := docsByFiles[filesKey]; doc != nil {
// We have seen this set of files before.
@@ -180,6 +182,9 @@
s.GOARCH = internal.All
}
}
+ if pkg == nil {
+ log.Debugf(ctx, "loadPackage returning nil")
+ }
return pkg, nil
}
diff --git a/internal/fetch/package.go b/internal/fetch/package.go
index 7da6096..966dc65 100644
--- a/internal/fetch/package.go
+++ b/internal/fetch/package.go
@@ -178,6 +178,7 @@
// If we got this far, the file metadata was okay.
// Start reading the file contents now to extract information
// about Go packages.
+ log.Debugf(ctx, "got %d directories of go files", len(dirs))
var pkgs []*goPackage
for innerPath, goFiles := range dirs {
if incompleteDirs[innerPath] {