• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kcl-lang / kcl-go / 36227370376
34%

Build:
DEFAULT BRANCH: main
Ran 26 Sep 2026 07:38AM UTC
Jobs 6
Files 107
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

26 Sep 2026 07:37AM UTC coverage: 30.011% (-0.007%) from 30.018%
36227370376

push

github

web-flow
feat(ast): align Go AST JSON with Rust source of truth (#600)

Bring the Go binding's AST struct definitions in pkg/ast in sync with the
serde JSON emitted by the Rust compiler in ../kcl/crates/ast/src/ast.rs.

Concretely:

- Drop `Module.Pkg`. Rust's Module struct has no `pkg` field, so the Go
  binding had no business exposing one.
- Fix NumberLit/StringLit/NameConstantLit discriminators on the
  `NewNumberLit`/`NewStringLit`/`NewNameConstantLit` constructors from
  `"Number"`/`"String"`/`"NameConstant"` (the inner Literal-enum form) to
  `"NumberLit"`/`"StringLit"`/`"NameConstantLit"` (the Expr-enum form that
  crosses the wire). The unmarshaller in pkg/ast/json.go already expects
  the long form on input, so this just fixes the constructors' output.
- Add `ConfigEntry.IsShorthand`. Rust's ConfigEntry has
  `is_shorthand: bool` with `#[serde(default, skip_serializing_if = ...)]`;
  the Go struct was missing it entirely.

Decorator and SchemaConfig are deliberately kept as separate DTOs rather
than being retyped to the polymorphic CallExpr/SchemaExpr forms. When a
CallExpr or SchemaExpr appears nested under NodeRef<T> (e.g. inside
SchemaStmt.decorators or UnificationStmt.value), the wire JSON does not
carry the `"type":"Call"` / `"type":"Schema"` discriminator — it is the
flat `{func,args,keywords}` / `{name,args,kwargs,config}` shape — so
encoding/json cannot resolve the polymorphic variant. This matches the
Java binding's existing design and is documented in
https://github.com/kcl-lang/lib/blob/main/AST_DRIFT.md (note A).

Add `pkg/parser/ast_alignment_test.go` which parses a real KCL fixture
through `parser.ParseFile` and verifies the JSON round-trips into the Go
AST structs. This is the Go equivalent of the Java
`AstJsonAlignmentTest`.

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>

0 of 7 new or added lines in 1 file covered. (0.0%)

2 existing lines in 1 file now uncovered.

4989 of 16624 relevant lines covered (30.01%)

2.06 hits per line

Uncovered Changes

Lines Coverage ∆ File
7
0.0
0.0% pkg/ast/expr.go

Coverage Regressions

Lines Coverage ∆ File
2
81.5
-1.16% pkg/format/xml/xml.go
Jobs
ID Job ID Ran Files Coverage
1 36227370376.1 26 Sep 2026 07:38AM UTC 107
30.0
GitHub Action Run
2 36227370376.2 26 Sep 2026 07:38AM UTC 107
30.0
GitHub Action Run
3 36227370376.3 26 Sep 2026 07:38AM UTC 107
30.01
GitHub Action Run
4 36227370376.4 26 Sep 2026 07:38AM UTC 107
30.01
GitHub Action Run
5 36227370376.5 26 Sep 2026 07:38AM UTC 107
30.01
GitHub Action Run
6 36227370376.6 26 Sep 2026 07:38AM UTC 107
30.01
GitHub Action Run
Source Files on build 36227370376
  • Tree
  • List 107
  • Changed 2
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 28201b23 on github
  • Prev Build on main (#36225844359)
  • Next Build on main (#36255287824)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc