-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Replace use of yaml.v2 library with yaml.v3 #7091
Replace use of yaml.v2 library with yaml.v3 #7091
Conversation
dff6637
to
a84d0cf
Compare
a84d0cf
to
d15cc46
Compare
@@ -2397,7 +2394,7 @@ func (b *metadataParser) Parse() (*Annotations, error) { | |||
if err != nil { | |||
return nil, err | |||
} | |||
case map[interface{}]interface{}: | |||
case map[string]any: |
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.
map[any]any
?
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.
Changes lgtm.
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.
LGTM 👍
Given that there already were some quirks with v2
, I don't see a reason for not bumping to v3
.
@@ -6058,7 +6058,7 @@ func TestAnnotationsAugmentedError(t *testing.T) { | |||
"# scope: rule\n" + | |||
"p := true\n", | |||
expErrorHint: "Hint: on line 4, symbol(s) ['\\u00a0'] immediately following a key/value separator ':' is not a legal yaml space character", | |||
expErrorRow: 5, | |||
expErrorRow: 6, // Should be 5 really, and yaml.v2 reported the error as on line 1, but v3 on line 3.. |
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.
Weird. But these are just hints after all; don't think this is enough to keep us in the lib stone ages.
t.Fatalf("Expected custom.string to be 'yes' but got %v", value) | ||
} | ||
} | ||
|
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.
👍
@@ -575,9 +575,6 @@ gopkg.in/check.v1 | |||
# gopkg.in/ini.v1 v1.67.0 | |||
## explicit | |||
gopkg.in/ini.v1 | |||
# gopkg.in/yaml.v2 v2.4.0 | |||
## explicit; go 1.15 | |||
gopkg.in/yaml.v2 |
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.
v3
shouldn't be vendored?
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.
Oh, we already had it vendored ..
Some quirks encountered in the upgrade: - Errors reported by the parser are now zero-indexed - A few errors seemingly reported on the line after the error rather than where it happened - Also a few tests where the line number reported *previously* seemed wrong but now is right - Something different in how the parser unmarshalled to the "raw" schema annotation type we used. Changed to use a a map instead of that type alias.. but I'm not really sure why that had to be done Perhaps worth looking into this further. But pushing this now to start that discussion. Fixes open-policy-agent#7090 Signed-off-by: Anders Eknert <[email protected]>
d15cc46
to
7f37d27
Compare
Some quirks encountered in the upgrade:
Perhaps worth looking into this further. But pushing this now to start that discussion.
Fixes #7090