Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SA1019: http.CloseNotifier has been deprecated since Go 1.11 #474

Open
wgd-ah opened this issue Sep 9, 2022 · 2 comments
Open

SA1019: http.CloseNotifier has been deprecated since Go 1.11 #474

wgd-ah opened this issue Sep 9, 2022 · 2 comments

Comments

@wgd-ah
Copy link

wgd-ah commented Sep 9, 2022

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.

@rs
Copy link
Owner

rs commented Sep 9, 2022

Feel free to send a PR.

@arl
Copy link

arl commented Nov 24, 2022

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants