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

Use UnmarshalStrict for yaml Unmarshalling #4017

Closed
krasi-georgiev opened this Issue Mar 27, 2018 · 6 comments

Comments

Projects
None yet
5 participants
@krasi-georgiev
Copy link
Member

krasi-georgiev commented Mar 27, 2018

The yaml library we are using now support UnmarshalStrict which will return an error for for unknowns, or double definitions
https://godoc.org/gopkg.in/yaml.v2#UnmarshalStrict

After start using UnmarshalStrict CheckOverflow will be no longer needer

func CheckOverflow(m map[string]interface{}, ctx string) error {
if len(m) > 0 {
var keys []string
for k := range m {
keys = append(keys, k)
}
return fmt.Errorf("unknown fields in %s: %s", ctx, strings.Join(keys, ", "))
}
return nil
}

@RichiH

This comment has been minimized.

Copy link
Member

RichiH commented Mar 27, 2018

Related to #1275 and as per IRC, @fabxc said: "I still think we should be using https://github.com/ghodss/yaml "

@krasi-georgiev

This comment has been minimized.

Copy link
Member Author

krasi-georgiev commented Mar 27, 2018

so basically if the other devs agree, replace gopkg.in/yaml with ghodss/yaml or just add PR to use UnmarshalStrict

@grobie

This comment has been minimized.

Copy link
Member

grobie commented Mar 27, 2018

@fabxc

This comment has been minimized.

Copy link
Member

fabxc commented Mar 27, 2018

@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Mar 27, 2018

I still fail to see the benefits of switching the data to a format that's not the one we're trying to parse.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 22, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 22, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.