Skip to content

Updating gogen from v1.19.7 to v1.20.2 causes test failures in TestFromTestdata #635

Description

@fennoai

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

  1. In go.mod, change gogen dependency:
- github.com/goplus/gogen v1.19.7
+ github.com/goplus/gogen v1.20.2
  1. Run go mod tidy

  2. 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

comment not terminated

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions