Skip to content

[Go] Generate gofmt-formatted flyweight code - #1130

Merged
vyazelenko merged 1 commit into
aeron-io:masterfrom
slachiewicz:go-flyweight-gofmt
Oct 12, 2026
Merged

vyazelenko merged 1 commit into
aeron-io:masterfrom
slachiewicz:go-flyweight-gofmt

Conversation

@slachiewicz

Copy link
Copy Markdown
Contributor

Fixes #1129. The Go flyweight generator's templates now produce what gofmt produces (tabs, top-level methods, aligned struct fields and const blocks, gofmt's layout for the ComputeLength parameters), following the struct generator's approach rather than shelling out to gofmt. For every schema under sbe-tool/src/test/resources and gocode/resources, gofmt of the previous output equals the new output byte for byte. That covers whitespace, redundant if parentheses and a lowercase float exponent.

Verified: gofmt -l over the generated flyweight code → empty (200 of 200 files listed before); the gocode flyweight packages and otf pass with gofmt -l in place of go fmt; ./gradlew :sbe-tool:test → 482 tests, 1 failure, GolangGeneratorTest.shouldHandleLowerCaseEnumValueReference, which fails on master too when it runs before a test that sets sbe.keyword.append.token.

The flyweight generator's templates now produce what gofmt produces, following the struct generator rather than shelling out to gofmt: gofmt of the previous output equals the new output for every schema the Go build uses.
@vyazelenko
vyazelenko merged commit 9c3aa07 into aeron-io:master Oct 12, 2026
34 checks passed
@slachiewicz
slachiewicz deleted the go-flyweight-gofmt branch October 12, 2026 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Go] Flyweight generator output is not gofmt-formatted

2 participants