internal/localdatasource: correctly initialize DataSource.sourceClient
Create a valid source.Client to avoid nil pointer dereference while
processing packages.
Change-Id: Id19a2ba07cfac8de85c9386a069d100b907421d2
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/280619
Reviewed-by: Jonathan Amsterdam <jba@google.com>
Trust: Julie Qiu <julie@golang.org>
Run-TryBot: Julie Qiu <julie@golang.org>
TryBot-Result: kokoro <noreply+kokoro@google.com>
diff --git a/internal/localdatasource/datasource.go b/internal/localdatasource/datasource.go
index 83e029a..96d63a6 100644
--- a/internal/localdatasource/datasource.go
+++ b/internal/localdatasource/datasource.go
@@ -15,6 +15,7 @@
"path/filepath"
"strings"
"sync"
+ "time"
"golang.org/x/pkgsite/internal"
"golang.org/x/pkgsite/internal/derrors"
@@ -35,6 +36,7 @@
// checks by default.
func New() *DataSource {
return &DataSource{
+ sourceClient: source.NewClient(1 * time.Minute),
loadedModules: make(map[string]*internal.Module),
}
}