Cookiejar error handling?

Just curios, why https://golang.org/pkg/net/http/cookiejar/#New has error in signature? There no places in code where error is actually returned.

I’m on mobile, so i haven’t been able to browse too much, but based on the limited git history that I did see, it looks like the public API of the cookiejar package was designed before the package implementation was actually written (e.g. in New’s history, it started out just returning a *Jar, but then was refactored to include an error but the body was just

// TODO
return nil, nil

I’m guessing they weren’t sure on what the implementation was going to be, but didn’t want to refactor the code that depends on the package later, so they kept the error return value just in case.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.