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

fix: import "math" in generated code for uint8 unmarshalling #53

Merged
merged 1 commit into from
Apr 22, 2021

Conversation

NexZhu
Copy link
Contributor

@NexZhu NexZhu commented Mar 31, 2021

This fix the following bug:

Currently generated code for unmarshalling uint8 field:

	// t.Type (service.TimeFilterType) (uint8)

	maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
	if err != nil {
		return err
	}
	if maj != cbg.MajUnsignedInt {
		return fmt.Errorf("wrong type for uint8 field")
	}
	if extra > math.MaxUint8 {
		return fmt.Errorf("integer in input was too large for uint8 field")
	}
	t.Type = TimeFilterType(extra)

math package is used in above code but the import statement for math is not generated, so generated code won't compile.

@Stebalien

@Stebalien Stebalien merged commit ad5b826 into whyrusleeping:master Apr 22, 2021
@Stebalien
Copy link
Collaborator

Thanks!

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

Successfully merging this pull request may close these issues.

2 participants