jkomoros / boardgame

An in-progress framework in golang to easily build boardgame Progressive Web Apps
Apache License 2.0
31 stars 4 forks source link

Codegen is broken for enums #779

Closed jkomoros closed 3 years ago

jkomoros commented 3 years ago

findEnums doesn't find the enums, because the magic text isn't visible in the genDecl.Doc.Text() for some reason. Did the behavior of doclines for paranthesized const declarations change in recent versions of Go?

jkomoros commented 3 years ago

No obvious culprits in the release notes for the last few go versions

jkomoros commented 3 years ago

genDecl.Doc.List shows the magic comment, but genDecl.Doc.Text does not...

jkomoros commented 3 years ago

Ah, the behavior of that method seems to have changed, perhaps with go:embed behavior being added?

"Text returns the text of the comment. Comment markers (//, /, and /), the first space of a line comment, and leading and trailing empty lines are removed. Comment directives like "//line" and "//go:noinline" are also removed. Multiple empty lines are reduced to one, and trailing space on lines is trimmed. Unless the result is empty, it is newline-terminated."

jkomoros commented 3 years ago

yeah, isDirective within the standard lib strips out the boardgame:codegen comment: https://golang.org/src/go/ast/ast.go?s=2508:2570#L66

jkomoros commented 3 years ago

Broke in https://github.com/golang/go/commit/5a550b695117f07a4f2454039a4871250cd3ed09