Description
What did you do?
go run cmd/pkgsite/main.go
Navigated to localhost:8080/net/http
. It's not necessarily net/http
; any module name that is not like github.com/owner/repo
triggers the panic.
What did you expect to see?
This page is not supported by the proxydatasource.
What did you see instead?
panic
2021/03/01 10:27:26 http: panic serving 82.79.132.177:52934: runtime error: invalid memory address or nil pointer dereference
goroutine 296 [running]:
net/http.(*conn).serve.func1(0xc015bb0000)
/usr/local/go/src/net/http/server.go:1772 +0x139
panic(0x12c6580, 0x2d03b70)
/usr/local/go/src/runtime/panic.go:973 +0x396
golang.org/x/pkgsite/internal/localdatasource.(*DataSource).GetUnitMeta(0xc001079cc0, 0x2308140, 0xc015ba85d0, 0xc015bbe025, 0x8, 0x1491599, 0x3, 0x1495f46, 0x6, 0x0, ...)
/tmp/pkgsite/pkgsite/internal/localdatasource/datasource.go:146 +0x310
golang.org/x/pkgsite/internal/frontend.(*Server).serveUnitPage(0xc00004a9c0, 0x2308140, 0xc015ba85d0, 0x22ff500, 0xc015bb2410, 0xc015be8400, 0x230d180, 0xc001079cc0, 0xc015ba8600, 0x0, ...)
/tmp/pkgsite/pkgsite/internal/frontend/unit.go:108 +0x1e4
golang.org/x/pkgsite/internal/frontend.(*Server).serveDetails(0xc00004a9c0, 0x22ff500, 0xc015bb2410, 0xc015be8400, 0x230d180, 0xc001079cc0, 0x0, 0x0)
/tmp/pkgsite/pkgsite/internal/frontend/details.go:65 +0x55d
golang.org/x/pkgsite/internal/frontend.(*Server).errorHandler.func1(0x22ff500, 0xc015bb2410, 0xc015be8400)
/tmp/pkgsite/pkgsite/internal/frontend/server.go:345 +0x9b
net/http.HandlerFunc.ServeHTTP(0xc016b80a80, 0x22ff500, 0xc015bb2410, 0xc015be8400)
/usr/local/go/src/net/http/server.go:2012 +0x44
go.opencensus.io/plugin/ochttp.WithRouteTag.func1(0x22ff500, 0xc015bb2410, 0xc015be8300, 0x1167b05, 0xc015be8300, 0xc016da7948)
/home/gabriel/Code/go/pkg/mod/go.opencensus.io@v0.22.4/plugin/ochttp/route.go:40 +0x201
go.opencensus.io/plugin/ochttp.taggedHandlerFunc.ServeHTTP(0xc015ba8570, 0x22ff500, 0xc015bb2410, 0xc015be8300)
/home/gabriel/Code/go/pkg/mod/go.opencensus.io@v0.22.4/plugin/ochttp/route.go:51 +0x54
golang.org/x/pkgsite/internal/dcensus.(*Router).Handle.func1(0x22ff500, 0xc015bb2410, 0xc015be8300)
/tmp/pkgsite/pkgsite/internal/dcensus/dcensus.go:65 +0xb9
net/http.HandlerFunc.ServeHTTP(0xc016b7b050, 0x22ff500, 0xc015bb2410, 0xc015be8300)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.(*ServeMux).ServeHTTP(0xc016b6e4c0, 0x22ff500, 0xc015bb2410, 0xc015be8300)
/usr/local/go/src/net/http/server.go:2387 +0x1a5
go.opencensus.io/plugin/ochttp.(*Handler).ServeHTTP(0xc016c24050, 0x22ff500, 0xc015bb2410, 0xc015be8100)
/home/gabriel/Code/go/pkg/mod/go.opencensus.io@v0.22.4/plugin/ochttp/server.go:92 +0x27e
golang.org/x/pkgsite/internal/middleware.Timeout.func1.1(0x22fdfc0, 0xc016c82000, 0xc015be8000)
/tmp/pkgsite/pkgsite/internal/middleware/timeout.go:20 +0x16b
net/http.HandlerFunc.ServeHTTP(0xc016b80b80, 0x22fdfc0, 0xc016c82000, 0xc015be8000)
/usr/local/go/src/net/http/server.go:2012 +0x44
net/http.serverHandler.ServeHTTP(0xc00106c9a0, 0x22fdfc0, 0xc016c82000, 0xc015be8000)
/usr/local/go/src/net/http/server.go:2807 +0xa3
net/http.(*conn).serve(0xc015bb0000, 0x2308080, 0xc015bc2000)
/usr/local/go/src/net/http/server.go:1895 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2933 +0x35c