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

[Bug]: codectool duplicate Unmarshal json #850

Closed
youkale opened this issue Nov 2, 2022 · 0 comments
Closed

[Bug]: codectool duplicate Unmarshal json #850

youkale opened this issue Nov 2, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@youkale
Copy link
Contributor

youkale commented Nov 2, 2022

Describe the bug

I found duplicate Unmarshal in the course of reading the code

branch: master
commit: b7ba81d
path : github.com/megaease/easegress/pkg/util/codectool

// Unmarshal wraps json.Unmarshal.
// It will convert yaml to json before unmarshal.
// Since json is a subset of yaml, passing json through this method should be a no-op.
func Unmarshal(data []byte, v interface{}) error {
	data, err := yamljsontool.YAMLToJSON(data)
	if err != nil {
		return fmt.Errorf("%s: convert yaml to json failed: %v", data, err)
	}
	json.Unmarshal(data, v)

	return json.Unmarshal(data, v)
}
@youkale youkale added the bug Something isn't working label Nov 2, 2022
youkale pushed a commit to youkale/easegress that referenced this issue Nov 2, 2022
youkale added a commit to youkale/easegress that referenced this issue Nov 2, 2022
@youkale youkale closed this as completed Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant