-
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
text/template/parse: backwards incompatible changes #25968
Comments
Some related discussion is over here: #25357 |
For some background, the last time |
I remain happy not to have this change at all, but seem to be in the minority. People want the feature. |
@dsnet What action do you propose? Drop the change? Re-rename the renamed public types/variables/etc back (is that enough?)? |
I would have originally thought that breaking the parse package was not possible, but since Rob approved the change and gave a reason in favor of doing so, I didn't give it more thought. I can have a look at undoing part of the changes to the parse package, so that Go1 compatibility is kept without reverting the entire CL and feature. That could be a short-term solution, while #25357 is more of a long-term one. As for the |
This is breaking a handful of targets inside Google. Personally, I don't think people should be depending on |
I don't think you can tell people not to depend on the package - many already do. The real question is whether it's OK to break those that do. We've vacillated on that point, but we have done it in the past. So: Can we document that we reserve the right to break users of this package? |
In an attempt to have our cake and eat it too, we could revert text/template/parse to its 1.10 state, freeze it, duplicate it to text/template/internal/parse, update text/template to use the internal package, and then re-apply the 1.11 changes there. The result is duplicated code, but since the non-internal package is frozen, that shouldn’t hurt too much. |
{text,html}/template use types from parse |
|
sorry, use types from parse in their public apis. Those wouldn't work right unless the internal/parse library types are aliases and at that point not much has been gained. |
May I present option (3): we introduce a CL that both keeps the new functionality and still retains most, if not all compatibility. Unless I'm missing something, this would involve:
I love the new template feature (I've wanted it on many occasions in the past) and I use the template/parse package directly too. Let's do both. I've read through the associated CL a few times, I'm not seeing a good reason why the API was broken in the first place. |
@kardianos yes, that's what I was suggesting in my first comment, just haven't found the time to write the CL yet :) |
Change https://golang.org/cl/120355 mentions this issue: |
Go developers have undone the breaking API changes in the following commit: commit bedfa4e1c37bd08063865da628f242d27ca06ec4 Author: Daniel Theophanes <[email protected]> Date: Thu Jun 21 10:41:26 2018 -0700 text/template/parse: undo breaking API changes golang.org/cl/84480 altered the API for the parse package for clarity and consistency. However, the changes also broke the API for consumers of the package. This CL reverts the API to the previous spelling, adding only a single new exported symbol. Fixes #25968 Change-Id: Ieb81054b61eeac7df3bc3864ef446df43c26b80f Reviewed-on: https://go-review.googlesource.com/120355 Reviewed-by: Daniel Martí <[email protected]> Reviewed-by: Rob Pike <[email protected]> Run-TryBot: Daniel Martí <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> See golang/go#25968 This reverts commit 9f27091. Closes #4784 Fixes #4873
https://golang.org/cl/84480 deliberately makes some breaking API changes saying:
Additionally, the documentation in
text/template/parse
says:Saying that the package is "not intended for general use" is not the same thing as "this package must not be used by any package other than text/template". As a result, there exist code that depends on the
parse
package that are now broken by this change and I don't believe it is okay to break them.According to the Go 1 compatibility document:
It isn't defined what the set of "standard packages" are, but unless an exception is provided, I think it is reasonable to expect that
parse
is considered one of them (even with the disclaimer and even if this would have been an internal-only package had they existed when the standard library was first created).\cc @mvdan @robpike @cybrcodr @bradfitz
The text was updated successfully, but these errors were encountered: