goplus / goplus/llcppg

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

Open
#635 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
33
Forks
11
Avg merge
1h 17m
Merged PRs (30d)
51

Description

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

  • #618 - Original issue tracking this bug

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with go.mod and the conversion code under cl/internal/convert, then run go test ./cl/internal/convert/ -run TestFromTestdata -v after changing gogen to v1.20.2. Compare the failing gettext, gpgerror, issue507, and keepcomment cases with the related issue #618. Done means these TestFromTestdata cases compile and pass with the updated dependency.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.