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

x/text/encoding/ianaindex: implement package #18278

Closed
nussjustin opened this issue Dec 10, 2016 · 4 comments
Closed

x/text/encoding/ianaindex: implement package #18278

nussjustin opened this issue Dec 10, 2016 · 4 comments

Comments

@nussjustin
Copy link
Contributor

The ianaindex package was added back in April 2015 (CL 8393 by @mpvl) as a proposed API, but was never actually implemented. Calling any method in the package leads to a panic.

The current state of the package is not documented and it is not clear to possible users that the package is basically just a proposal and not usable. Most users will only find out when running the code or by reading the code.

This is very unfortunate, especially since there is currently no (documented) way to get the names of all encodings in the golang.org/x/text/encoding sub-packages. Users who want to get encodings by name or vice versa must currently resort to asserting and calling the (undocumented) String() method on the encodings and building the mappings themself. This still doesn't completely solve the problem since the String() method on the encodings doesn't return the MIME or IANA name of the encodings (and can't return both).

I think the current situation is the worst case for the package and a decision should be taken. I've listed the 3 possible actions/solutions that can be taken (and that I can currently think of) below.

  1. Updating the documentation to note the current state

    This is not a solution, but could be used as temporary solution before making a final decision on the future of the package.

  2. Finalizing and implementing the package API

    This is probably the best solution for users of the golang.org/x/text/encoding packages, but means that someone would have to implement and maintain the API.

    The proposal is currently incomplete (there is a TODO about a Set method in there, as well as a few TODOs and a NOTE below the imports) and should probably revised (maybe with a new issue for the API design).

  3. Removing the package

    This solution has the obvious drawback that users can't get encodings by name or vice versa, at least not through the public API. Considering the current state of the package, this wouldn't remove any usable functionality or impact an other packages or applications (if it does, I want to see the code that uses it).

Basically I see it as coming down to the question of whether the package should be kept and implemented or deleted.

/cc @nigeltao (as reviewer of the original CL)

@nigeltao
Copy link
Contributor

I'd like to see it kept and implemented, but I don't have much free time right now, and @mpvl is on long-term leave.

@gopherbot
Copy link

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

gopherbot pushed a commit to golang/text that referenced this issue Dec 16, 2016
Updates golang/go#18278

Change-Id: I1713bff63db5e68e074043f8f34c4998a4ab1275
Reviewed-on: https://go-review.googlesource.com/34530
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
@rsc
Copy link
Contributor

rsc commented Jan 4, 2017

Nigel did option 1. Eventually we will implement the package.

@rsc rsc added this to the Unreleased milestone Jan 4, 2017
@rsc rsc changed the title x/text/encoding/ianaindex: deciding on the future of the package x/text/encoding/ianaindex: implement package Jan 4, 2017
@gopherbot
Copy link

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

@mpvl mpvl self-assigned this Feb 9, 2017
@golang golang locked and limited conversation to collaborators Feb 9, 2018
@rsc rsc unassigned mpvl Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants