I've been using go for a month now in a new job and hate it. It feels like they learned nothing from the past 20 years of language development. Just one huge problem is that they REPEATED Java's million/billion dollar mistake with nulls. The usual way to get HTTP Headers using Go cannot distinguish between an empty header value and no header at all because the method returns "nil" for both these cases. They could've…
> The usual way to get HTTP Headers using Go cannot distinguish between an empty header value and no header at all HTTP headers in Go are maps, which have a built-in mechanism for checking key existence, which distinguishes b/t empty and missing. No nils involved. if vals, ok := headers["Content-Length"]; !ok { // no content-length header was passed }
Like this doesn't work:
nonexist, ok := req.Header.Get("X-Custom-Header")