zerolog
zerolog copied to clipboard
SA1019: http.CloseNotifier has been deprecated since Go 1.11
We have a reasonably tight golangci-lint setup that zerolog does not currently pass. Nothing else is glaring or insurmountable from the results (most are pretty pedantic) but one that is pretty glaring is:
hlog/internal/mutil/writer_proxy.go:33:14: SA1019: http.CloseNotifier has been deprecated since Go 1.11 and an alternative has been available since Go 1.7: the CloseNotifier interface predates Go's context package. New code should use Request.Context instead. (staticcheck)
_, cn := w.(http.CloseNotifier)
^
hlog/internal/mutil/writer_proxy.go:111:38: SA1019: http.CloseNotifier has been deprecated since Go 1.11 and an alternative has been available since Go 1.7: the CloseNotifier interface predates Go's context package. New code should use Request.Context instead. (staticcheck)
cn := f.basicWriter.ResponseWriter.(http.CloseNotifier)
^
hlog/internal/mutil/writer_proxy.go:149:4: SA1019: http.CloseNotifier has been deprecated since Go 1.11 and an alternative has been available since Go 1.7: the CloseNotifier interface predates Go's context package. New code should use Request.Context instead. (staticcheck)
_ http.CloseNotifier = &fancyWriter{}
^
Also, one that is somewhat amusing is:
diode/diode.go:111:16: SA6002: argument should be pointer-like to avoid allocations (staticcheck)
bufPool.Put(p[:0])
^
Anyway, this is all on master, cloned 2022-09-08, and I don't see any open issues on CloseNotifier.
Feel free to send a PR.
diode/diode.go:111:16: SA6002: argument should be pointer-like to avoid allocations (staticcheck) bufPool.Put(p[:0]) ^
That's interesting. Are we definitely allocating something here or is staticcheck showing a false positive? Did anyone check?