Skip to content

Issue with boolean custom types in generated ffjson file #264

Description

@acabarbaye

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions