Skip to content

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

@moznion

Description

@moznion

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions