-
Notifications
You must be signed in to change notification settings - Fork 76
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
use gopkg.in/laverya/yaml.v3 instead of gopkg.in/yaml.v2 #26
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: laverya The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
I missed the addition of |
this supports 64 bit floats and longer string lines
And so here is a version that keeps |
cc @sttts |
Background: we need JSONObjectToYAMLObject and the (exact) v2 MapSlice type to interface with https://github.com/googleapis/gnostic. |
What does this mean in practice? Which existing UX does this break? |
It means that the yaml parser will throw an error if duplicate keys are detected. I do not know of any specific use cases that this would break, though - besides the obvious one of "parse whatever junk the users threw at me". On reflection, this may constitute a breaking API change. There is still a difference between
Ouch. That project seems to use MapSlice a lot, and it's never fun to rely on a type/method/etc that gets removed by a major version bump... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all Unmarshal calls are now strict.
was strict unmarshalling actually enabled by default without a toggle?
this can be "quite" breaking for the k8s space if we move to v3.
looks like, yes:
https://github.com/go-yaml/yaml/blob/v3/yaml.go#L88
https://github.com/go-yaml/yaml/blob/v2/yaml.go#L80-L88
EDIT: no it does not, it still passes strict=false
to unmarshal
go.mod
Outdated
@@ -4,5 +4,6 @@ go 1.12 | |||
|
|||
require ( | |||
github.com/davecgh/go-spew v1.1.1 | |||
gopkg.in/laverya/yaml.v3 v3.0.0-beta1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why include v3 from your fork. what differences it has from upstream?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two major ones - the first is that it has tags
The second is the inclusion of go-yaml/yaml#455 - "Add a function to set the desired line length of an Encoder" which would resolve kubernetes-sigs/kustomize#947
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The full diff is here: go-yaml/yaml@v3...laverya:v3.0.0-beta1
7 additional commits
Sounds like adding an explicit "UnmarshalUnsafe" function might be worthwhile in |
negating API methods is breaking too. at least the change was part of a MAJOR, yet this leaves us in a space where we have to fork v3 if we want to move to it. |
I meant something more along the lines of "add the negation method to the upstream, and use it to keep |
@neolit123 unmarshal behavior with duplicate keys should be restored now through the use of |
thanks for the update @laverya , with this PR we are again introducing a private repository as a dependency. |
That makes perfect sense, and honestly I would not want my fork as a key dependency either 😆 I'd initially intended to wait for the upstream to merge things before making this PR, but as time goes on that's looking more and more like it won't happen without some sort of external impetus - and this could be that impetus. Postponing a merge until we can switch back to |
How would we feel about creating a v3 branch of this repo that uses (the patched) yaml.v3? This will downstream repos to safely start opting into the new behavior by changing their import path |
I'd be happy with that! Either with a 'laverya' dependency or something actually owned by kubernetes |
I opened #29 to update the v2 version to v2.2.7 |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@laverya: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Rotten issues close after 30d of inactivity. Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
@fejta-bot: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
gnostic now also uses |
is there any chance in reopening this or creating a new PR to have this done? |
#76 is plan to update this repo to use yaml.v3 while preserving compatibility with existing formatting That PR is pending on some remaining comments - see #76 (comment) |
this supports 64 bit floats and longer string lines
see #18
(
laverya/yaml.v3
instead ofyaml.v3
because the fork supports setting line length, and the original has no releases to pin)A disadvantage of this upgrade is that there is no longer
UnmarshalStrict
- allUnmarshal
calls are now strict. As mentioned later in the thread, this likely constitutes a breaking change.