Package whcompat provides webhelp compatibility across different Go releases.
The webhelp suite depends heavily on Go 1.7 style http.Request contexts, which aren't available in earlier Go releases. This package backports all of the functionality in a forwards-compatible way. You can use this package to get the desired behavior for all Go releases.
CloseNotify causes a handler to have its request.Context() canceled the second the client TCP connection goes away by hooking the http.CloseNotifier logic into the context. Prior to Go 1.8, this costs an extra goroutine in a read loop. Go 1.8 and on, this behavior happens automatically with or without this wrapper.
Context is a light wrapper around the behavior of Go 1.7's (*http.Request).Context method, except this version works with earlier Go releases, too. In Go 1.7 and on, this simply calls r.Context(). See the note for WithContext for how this works on previous Go releases. If building with the appengine tag, when needed, fresh contexts will be generated with appengine.NewContext().
DoneNotify cancels request contexts when the http.Handler returns in Go releases prior to Go 1.7. In Go 1.7 and forward, this is a no-op. You get this behavior for free if you use whlog.ListenAndServe.
WithContext is a light wrapper around the behavior of Go 1.7's (*http.Request).WithContext method, except this version works with earlier Go releases, too. IMPORTANT CAVEAT: to get this to work for Go 1.6 and earlier, a few tricks are pulled, such as expecting the returned r.URL to never change what object it points to, and a finalizer is set on the returned request.