Entries from 2018-08-21 to 1 day

gorilla/sessions と gorilla/context と net/http.Request.WithContext で気をつけること

net/http には net/http.Request.WithContext という context を紐付け直すメソッドがある。 実装はこうなっている。 func (r *Request) WithContext(ctx context.Context) *Request { if ctx == nil { panic("nil context") } r2 := new(Request) *r2 = *r …