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

proposal: json UnmarshallTo #66723

Closed
maxtreaming opened this issue Apr 8, 2024 · 1 comment
Closed

proposal: json UnmarshallTo #66723

maxtreaming opened this issue Apr 8, 2024 · 1 comment
Labels
Milestone

Comments

@maxtreaming
Copy link

Proposal Details

Current implementation of json Unmarshall requires to create a variable that will be used to unmarshall data to.

Since go has generics, we could have that step wrapped into a helper function:

func UnmarshallTo[T any](data []byte) (T, error) {
	var result T
	err := json.Unmarshal(data, &result)
	return result, err
}
@gopherbot gopherbot added this to the Proposal milestone Apr 8, 2024
@seankhliao
Copy link
Member

I believe this should be part of the #63397 discussion

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants