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/cookiejar: New does not need an error as return argument #18685

Closed
morriswinkler-simple opened this issue Jan 17, 2017 · 3 comments
Closed
Labels
FrozenDueToAge v2 A language change or incompatible library change

Comments

@morriswinkler-simple
Copy link

func New(o *Options) (*Jar, error) {

Should not return an error, since it will always yield nil it is useless.

@mdlayher mdlayher changed the title net/http/cookiejar New() does not need an error as return argument net/http/cookiejar: New does not need an error as return argument Jan 17, 2017
@mdlayher
Copy link
Member

Too late to fix now, it would break Go 1 compatibility to modify the return values of that function.

At some point, it probably did return an error, but since the signature can't be changed, the error return is always nil now.

@mdlayher mdlayher added the v2 A language change or incompatible library change label Jan 17, 2017
@ALTree
Copy link
Member

ALTree commented Jan 17, 2017

I think the API was designed that way to allow for a future different/more complex implementation. Here's a golang-dev discussion: https://groups.google.com/forum/#!topic/golang-dev/ygDB3nbir00/discussion

cc @nigeltao who designed the api

@morriswinkler-simple
Copy link
Author

Ok makes sense, but from a design point, the new method is not part of the interface. More complex storage implementations could still have their own New func with custom signature.

But well too late is too late, did not think about that.

@golang golang locked and limited conversation to collaborators Jan 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge v2 A language change or incompatible library change
Projects
None yet
Development

No branches or pull requests

4 participants