Repository navigation
[Go] Generate gofmt-formatted flyweight code - #1130
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1129. The Go flyweight generator's templates now produce what
gofmtproduces (tabs, top-level methods, aligned struct fields and const blocks, gofmt's layout for theComputeLengthparameters), following the struct generator's approach rather than shelling out togofmt. For every schema undersbe-tool/src/test/resourcesandgocode/resources,gofmtof the previous output equals the new output byte for byte. That covers whitespace, redundantifparentheses and a lowercase float exponent.Verified:
gofmt -lover the generated flyweight code → empty (200 of 200 files listed before); thegocodeflyweight packages andotfpass withgofmt -lin place ofgo fmt;./gradlew :sbe-tool:test→ 482 tests, 1 failure,GolangGeneratorTest.shouldHandleLowerCaseEnumValueReference, which fails onmastertoo when it runs before a test that setssbe.keyword.append.token.