golang / gddo

Go Doc Dot Org
https://godoc.org
BSD 3-Clause "New" or "Revised" License
1.1k stars 265 forks source link

https://godoc.org/golang.org/x/sys/unix/aliases.go returns 500 Internal server error. #640

Closed nyt-hughmandeville closed 5 years ago

nyt-hughmandeville commented 5 years ago

https://godoc.org/golang.org/x/sys/unix/aliases.go returns 500 Internal server error.

$ curl -i "https://godoc.org/golang.org/x/sys/unix/aliases.go"
HTTP/2 500
date: Fri, 09 Aug 2019 22:53:53 GMT
content-type: text/plain; charset=utf-8
content-length: 22
x-cloud-trace-context: 329a37b1d1b7dd019397c8be77ca25e7/1832251762085882494;o=1
via: 1.1 google

Internal server error.
dmitshur commented 5 years ago

The problem is here:

https://github.com/golang/gddo/blob/af0f2af80721261f4d211b2c9563f7b46b2aab06/gosrc/vcs.go#L294-L304

We're opening a file with the expectation it's a directory, then trying to read its contents. We're not handling the error condition where the file exists but is not a directory. I'll send a fix.

Edit: Sent CL 190397.