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

Issue with boolean custom types in generated ffjson file #264

Open
acabarbaye opened this issue Oct 15, 2021 · 0 comments
Open

Issue with boolean custom types in generated ffjson file #264

acabarbaye opened this issue Oct 15, 2021 · 0 comments

Comments

@acabarbaye
Copy link

As per my API definition, I have defined some custom types which actually are booleans:
e.g.

type EmbedParam bool

in the generated code, I get

	var tval bool

	if bytes.Compare([]byte{'t', 'r', 'u', 'e'}, tmpb) == 0 {

		tval = true

	} else if bytes.Compare([]byte{'f', 'a', 'l', 's', 'e'}, tmpb) == 0 {

		tval = false

	} else {
		err = errors.New("unexpected bytes for true/false value")
		return fs.WrapErr(err)
	}

	j.Embed = &tval

tval is defined as a bool instead of EmbedParam like Embed, meaning I get the following compilation error:

.\****_ffjson.go:***:12: cannot use &tval (type *bool) as type *EmbedParam in assignment

Could the local variable be defined using the custom type i.e. var tval EmbedParam?

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