Problem
Updating github.com/goplus/gogen from v1.19.7 to v1.20.2 causes multiple TestFromTestdata tests to fail with compilation errors related to block comment formatting.
How to Reproduce
- In
go.mod, change gogen dependency:
- github.com/goplus/gogen v1.19.7
+ github.com/goplus/gogen v1.20.2
-
Run go mod tidy
-
Run tests:
go test ./cl/internal/convert/ -run TestFromTestdata -v
Error Messages
TestFromTestdata/gettext
expected declaration, found The
TestFromTestdata/gpgerror
expected declaration, found '*'
TestFromTestdata/issue507
Multiple block comment syntax errors
TestFromTestdata/keepcomment
Root Cause
These errors occur because multi-line C block comments like:
/* Create an iterator for traversing a domain
The domain NULL denotes the default domain */
Are split into multiple ast.Comment nodes (one per line) instead of a single node. With gogen v1.20.2, the Go printer now strictly follows the ast.Comment specification and produces invalid Go code from these incorrectly split comments.
Example of invalid generated output with gogen v1.20.2:
/* Create an iterator for traversing a domain
*/ The domain NULL denotes the default domain */
*/func ExampleFunction() {
}
Related
Problem
Updating
github.com/goplus/gogenfromv1.19.7tov1.20.2causes multipleTestFromTestdatatests to fail with compilation errors related to block comment formatting.How to Reproduce
go.mod, change gogen dependency:Run
go mod tidyRun tests:
go test ./cl/internal/convert/ -run TestFromTestdata -vError Messages
TestFromTestdata/gettextTestFromTestdata/gpgerrorTestFromTestdata/issue507TestFromTestdata/keepcommentRoot Cause
These errors occur because multi-line C block comments like:
Are split into multiple
ast.Commentnodes (one per line) instead of a single node. With gogenv1.20.2, the Go printer now strictly follows theast.Commentspecification and produces invalid Go code from these incorrectly split comments.Example of invalid generated output with gogen v1.20.2:
Related