2020/08/10 09:20:14 http: panic serving [::1]:55541: runtime error: slice bounds out of range [:-5]
goroutine 1138 [running]:
net/http.(*conn).serve.func1(0xc0001443c0)
/usr/local/go/src/net/http/server.go:1800 +0x139
panic(0x176f6c0, 0xc0006e29c0)
/usr/local/go/src/runtime/panic.go:975 +0x3e3
golang.org/x/tools/godoc.(*Presentation).serveFile(0xc0002f8000, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/Users/straut/go/pkg/mod/golang.org/x/tools@v0.0.0-20200617212913-87be026d3888/godoc/server.go:778 +0x87d
golang.org/x/tools/godoc.(*Presentation).ServeFile(...)
/Users/straut/go/pkg/mod/golang.org/x/tools@v0.0.0-20200617212913-87be026d3888/godoc/server.go:753
net/http.HandlerFunc.ServeHTTP(0xc00031a480, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/usr/local/go/src/net/http/server.go:2041 +0x44
net/http.(*ServeMux).ServeHTTP(0xc000fbc080, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/usr/local/go/src/net/http/server.go:2416 +0x1a5
golang.org/x/tools/godoc.(*Presentation).ServeHTTP(0xc0002f8000, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/Users/straut/go/pkg/mod/golang.org/x/tools@v0.0.0-20200617212913-87be026d3888/godoc/pres.go:143 +0x4d
net/http.(*ServeMux).ServeHTTP(0xc000b70540, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/usr/local/go/src/net/http/server.go:2416 +0x1a5
main.hostEnforcerHandler.ServeHTTP(0x1a18b20, 0xc000b70540, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/Users/straut/Documents/workfiles/go/repo/git/website/cmd/golangorg/handlers.go:45 +0x380
net/http.(*ServeMux).ServeHTTP(0x1e9e580, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/usr/local/go/src/net/http/server.go:2416 +0x1a5
net/http.serverHandler.ServeHTTP(0xc0001da2a0, 0x1a24aa0, 0xc0001da460, 0xc0003ca400)
/usr/local/go/src/net/http/server.go:2836 +0xa3
net/http.(*conn).serve(0xc0001443c0, 0x1a25e20, 0xc000fbc280)
/usr/local/go/src/net/http/server.go:1924 +0x86c
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:2962 +0x35c
What version of Go are you using (
go version)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env)?go envOutputWhat did you do?
var files = []string{ ... }:What did you expect to see?
The index page I created loads when I visit the directory in a browser.
What did you see instead?
The panic above.