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

resource type is interface, may be string, or []byte, all handle with json Marshal is not right #54

Open
aseTo2016 opened this issue Jan 15, 2022 · 0 comments

Comments

@aseTo2016
Copy link
Contributor

resource type is interface, may be string, or []byte, all handle with json Marshal is not right

	var resourceValue []byte
	switch rv := resource.(type) {
	case string:
		resourceValue = []byte(rv)
	case []byte:
		resourceValue = rv
	default:
		resourceValue, err = json.Marshal(resource)
		if err != nil {
			return nil, err
		}
	}
little-cui pushed a commit that referenced this issue Jan 15, 2022
…with… (#53)

* resource type is interface, may be string, or []byte, all handle with json Marshal is not right

* code check failed

Co-authored-by: aseTo2016 <tys201193111>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant