-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
proposal: embed: bring back String and Bytes for convenience/documentation #44089
Comments
This is a duplicate of #43217 (as you know). |
A lot of things were discussed at once. My feeling was that there was consensus that embed.String/Bytes should not be the only way of declaring an embed and other type aliases for string/bytes should be allowed. I didn’t think there was discussion/consensus about whether there should be an additional way of declaring an embed string/byte slice for convenience and documentation. Let’s leave this open for a while and see if anyone gives it a thumbs up or not. If not, I’ll accept that there was a consensus against embed package aliases. |
My comment for keeping the aliases had 7 thumbs up and one thumbs down even after the issue with import restrictions was discovered FWIW: #43217 (comment) I could be wrong but my sense was that we agreed that disallowing plain string and other type aliases was bad but having an embed.String alias for documentation reasons was good (ditto bytes). |
In general the Go approach is not to provide multiple ways of doing something, just one standard way. If we create a second standard way (and anything in package embed is clearly "standard"), See for example #44143. In that case there was a good reason to have two standard things Here there is not a similarly compelling reason to have more than one way to do something. Stepping back a bit, it is important to the forward progress of the proposal process generally Closing as duplicate of #43217. |
I still don’t agree that this is a REconsideration, but I appreciate the argument that there should be one way to do it. At this point, the ship has sailed on Go 1.16, so bon voyage to embed.String, it’s too late for that to be the one standard, docs and tutorials are already being published… 🛳 👋 |
It is getting extremely late for Go 1.16, but for 1.17, I propose bringing back the String and Bytes type aliases in package embed. They’re a convenient way to document intent and they help goimport. Plus if #43698 is accepted they can add an error if the comment is accidentally omitted.
The text was updated successfully, but these errors were encountered: