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

It breaks code generation if the property name is the reserved word #8

Open
moznion opened this issue Jul 26, 2021 · 0 comments
Open
Labels
bug Something isn't working

Comments

@moznion
Copy link
Owner

moznion commented Jul 26, 2021

example:

//go:generate gonstructor --type=Foo --constructorTypes=allArgs
type Foo struct {
	Type string
}

It outputs like the following error when it consumes the above structure:

2021/07/26 23:44:37 [error] failed to generate code: [GOWRTR-13] code formatter raises error: command='gofmt -e', err='<standard input>:5:14: expected type, found 'type'
<standard input>:7:9: expected operand, found 'type'
<standard input>:7:9: missing ',' in composite literal
<standard input>:7:13: expected operand, found ','
<standard input>:10:2: expected ';', found 'EOF'
<standard input>:10:2: expected ';', found 'EOF'
<standard input>:10:2: expected '}', found 'EOF'
<standard input>:10:2: expected '}', found 'EOF'
<standard input>:10:2: missing ',' in composite literal
', msg='exit status 2'

This because type is a reserved word of golang.

@moznion moznion added the bug Something isn't working label Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant