embed: go1.16beta1 http.FileServer runtime error: invalid memory address or nil pointer dereference #43682
Comments
Marking as a release blocker for 1.16, as it seems that it might be a bug in the new |
CC @jayconrod @rsc |
3 looks identicial to 1. are you saying one works and one doesn‘t? |
Yes, they are the same; It's just the steps to reproduce the bug. |
It looks like the
(Note also that in 1.16, the This seems like it might come up a lot. Maybe |
Should it be a compile-time error to instantiate a value of type If not, should the |
Ah, I see that's addressed in the documentation:
So the fact that |
That said, I think at the very least |
Not necessarily, especially for local variables and fields. It's essentially a reference type, so I could see copying it into a variable that's uninitialized.
That seems like the thing to fix. All the other methods call that.
+1 to that. Should that be a new check or part of something existing? I think other pragmas have the same comment restriction, and we might want to check them all. |
Filed the |
Change https://golang.org/cl/283852 mentions this issue: |
Indeed, it's the space before |
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 env
OutputWhat did you do?
I'm using the "embed" package available with go1.16beta1.
I'm trying to implement a web server using http.ListenAndServe to render my Angular build Website.
embed
was working fine until I replace thehttp.FS
byhttp.Dir
.Now,
http.Dir
insidehttp.FileServer
is working fine buthttp.FS
and soembed
are not working anymore.I have a crash
http: panic serving [::1]:50241: runtime error: invalid memory address or nil pointer dereference
either callinglocalhost:8080
on my web browser or just need to wait few seconds to receive the crash from the server.Reproduce the behaviour
Need to have a folder 'a' containing for example a file such as 'index.html'.
Step 1
go1.16beta1 run main.go
Step 2
go1.16beta1 run main.go
Step 3
go1.16beta1 run main.go
Step 3
The server should not working anymore and return a crash.
http: panic serving [::1]:50241: runtime error: invalid memory address or nil pointer dereference
See below for more details.
What did you expect to see?
The file rendered in the web browser.
What did you see instead?
The text was updated successfully, but these errors were encountered: