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

UUID in errors causes package and parameter conflict #78

Open
chris05atm opened this issue Jul 27, 2019 · 0 comments
Open

UUID in errors causes package and parameter conflict #78

chris05atm opened this issue Jul 27, 2019 · 0 comments

Comments

@chris05atm
Copy link

What happened?

Define a conjure errors type like this:

types:
  definitions:
    default-package: com.foo.bar
    errors:
      CollisionError:
        namespace: MyNameSpace
        code: PERMISSION_DENIED
        safe-args:
          uuid: optional<uuid>

This generates code like this:

// NewCollisionError returns new instance of CollisionError error.
func NewCollisionError(uuid *uuid.UUID) *CollisionError {
	return &CollisionError{errorInstanceID: uuid.NewUUID(), collisionError: collisionError{Uuid: uuid}}
}

Parameter name uuid collides with the package uuid and results in the parameter's function being called instead of the uuid package's NewUUID function.

Compile errors result.

What did you want to happen?

The parameter name should be munged to something like uuidArg or something (to avoid collision).

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