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

net/http: ErrWriteAfterFlush unused #15150

Closed
perillo opened this issue Apr 6, 2016 · 4 comments
Closed

net/http: ErrWriteAfterFlush unused #15150

perillo opened this issue Apr 6, 2016 · 4 comments
Assignees
Milestone

Comments

@perillo
Copy link

@perillo perillo commented Apr 6, 2016

The variable ErrWriteAfterFlush, defined in net/http/server.go, is never used.

After a bit of code archaeology with git, I found that the variable was introduced in https://github.com/golang/go/blob/e73acc1b35f3490f3d800b4bf49da79630e808fc/src/lib/http/server.go, but at some point it was no more used.

@perillo

This comment has been minimized.

Copy link
Author

@perillo perillo commented Apr 6, 2016

The unused tool, with the -export flag, also reports the following error variables to be unused:

  • ErrHeaderTooLong
  • ErrShortBody
  • ErrNotSupported
  • ErrMissingContentLength
  • ErrNoCookie
  • ErrLineTooLong

However I have not checked if they are obsolete as with ErrWriteAfterFlush.

@dominikh

This comment has been minimized.

Copy link
Member

@dominikh dominikh commented Apr 6, 2016

All of those are part of the public API and cannot be removed under the Go 1 compatibility guarantee. Also, most of these are defined in terms of their net/http/internal counterpart, are returned from internal and used by users of net/http.

As an aside, unused -exported is not at all useful for the standard library, except when checking internal packages. All exported identifiers in the stdlib are by their nature used by users of Go.

@perillo

This comment has been minimized.

Copy link
Author

@perillo perillo commented Apr 6, 2016

On Wed, Apr 6, 2016 at 12:34 PM, Dominik Honnef notifications@github.com
wrote:

All of those are part of the public API and cannot be removed under the Go
1 compatibility guarantee. Also, most of these are defined in terms of
their net/http/internal counterpart are returned from internal and used
by users of net/http.

At least ErrWriteAfterFLush seems to be obsolete. Of course it can not be
removed, but a comment can be added to explain that it is no more used.

IMHO, a variable without a comment and that appears to be never used, only
cause confusion for users (at least for me).

@bradfitz bradfitz self-assigned this Apr 6, 2016
@bradfitz bradfitz added this to the Go1.7 milestone Apr 6, 2016
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented May 1, 2016

CL https://golang.org/cl/22658 mentions this issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.