373 karma · joined March 11, 2013
So why isn't extension support considered a must-have?
Personally, I don't care for "string magic"
Edit: Instead of making another post, I'll add this here. It also feels odd that concerns about xerrors.As possibly panicking at runtime are considered addressed by the addition of a go vet check: https://github.com/golang/go/issues/29934#issuecomment-46252...
I am not opposed to go vet, to be clear, but one of the aspects of the go compiler is that it does not warn, only errors out if compilation can't proceed. But the design of xerrors.As is fine because go vet acts like a compiler warning might? This is an aesthetic complaint more than anything else, but it still doesn't sit right with me.
This still reads as unnecessarily acidic to me, given the update notice at the top of the article.
https://en.wikipedia.org/wiki/Talk%3AFFTW#Bernstein_%22contr...
func SomeHandler(foo Foo) {
return func(w http.ResponseWriter, req *http.Request) {
// use foo
}
}
// later, during init
http.HandleFunc("/foo", SomeHandler(someFoo))
or method values, introduced in go 1.1: type handler struct {
foo Foo
}
func (h *handler) bar(w http.ResponseWriter, req *http.Request) {
// use h.foo
}
func (h *handler) qux(w http.ResponseWriter, req *http.Request) {
// use h.foo
}
// later
h := handler{
foo: someFoo,
}
http.HandleFunc("/bar", h.bar)
http.HandleFunc("/qux", h.qux)