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

ResultType redeclared in generated files if used more than once as Method -> Result using different views #2723

Closed
rozagerardo opened this issue Nov 21, 2020 · 1 comment · Fixed by #2742
Labels

Comments

@rozagerardo
Copy link

If I use the same ResultType in more than one Method -> Result sing different Views , the goa gen command generates a views/view.go declaring the type twice.

Naturally, if I try to build the project, the command fails:

# calc/gen/objects/views
gen\objects\views\view.go:25:6: ObjectMedia redeclared in this block
        previous declaration at gen\objects\views\view.go:17:6
gen\objects\views\view.go:91:6: ValidateObjectMedia redeclared in this block
        previous declaration at gen\objects\views\view.go:77:52

I have observed this for version 3.2.5, I was previously using version 3.2.0 and this issue was not present back then.

This might be related to this other reported bug, maybe they are both caused by the same issue:
#2681

Here I have reproduced the bug in a simple project:
https://github.com/rozagerardo/samples/tree/go/goa/bugs/redeclared-types

Here I'm using the ResultType in two different Methods:
https://github.com/rozagerardo/samples/blob/go/goa/bugs/redeclared-types/calc/design/design.go#L117

And this is the generated view.go file, declaring the type twice:
https://github.com/rozagerardo/samples/blob/go/goa/bugs/redeclared-types/calc/gen/objects/views/view.go#L16

@raphael
Copy link
Member

raphael commented Dec 13, 2020

Thank you for report and the repro, looks like a regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants