-
Notifications
You must be signed in to change notification settings - Fork 525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Go] SbeTool generator FormatFlagsConversionMismatchException #844
Comments
Added some instrumentation to the generator:
It's the Looks like there's supposed to be an invariant that Simply hard-coding the length at line 2019 works with this schema as well as my original schema.
|
neomantra
added a commit
to neomantra/simple-binary-encoding
that referenced
this issue
May 11, 2021
Add functions `generateWhitespace` and `generateLongestWhitespace` to replace repated invocations. `generateWhitespace` ensures at least one space is created. This change should only affect the whitespace of the output.
neomantra
added a commit
to neomantra/simple-binary-encoding
that referenced
this issue
May 11, 2021
Adds function `generateWhitespace` which uses the same String.format technique, but validates the input. It also always generates at least one space. This change should only affect the whitespace of the output. It does not attempt to change the logic that might be the underlying cause of real-logic#844.
mjpt777
pushed a commit
that referenced
this issue
May 12, 2021
* [Go] Refactor whitespace in GolangGenerator (#844) Adds function `generateWhitespace` which uses the same String.format technique, but validates the input. It also always generates at least one space. This change should only affect the whitespace of the output. It does not attempt to change the logic that might be the underlying cause of #844. * [Go] Fix type name for nested composites (#847) There was a typo in type name generation of nested composites. It was using the `propertyName` instead of `propertyType`. Add a test case and unit test. This situation wasn't elicited before because nested property types and names are the same in tests (e.g. `Engine`). Prior to the change, the test case in this changeset would show: `./MessageHeader.go:16:14: undefined: MessageHeaderC1` Also set GO111MODULE in Makefile for Go 1.16 builds. * [Go] fix excess import generation (#848) The previous implementation used a single `TreeSet` member to track the import names. This was done as a member to not have to pass the imports to many functions. A given file should only have its imports. Due to traversal of messages and components, there are times where there are too many. The `TreeSet` needs to be fresh for each file. This commit changes `imports` from a single `TreeSet` to a `Stack<TreeSet>`. Each time where there was a line: `imports = new TreeSet<>()` (always near a `outputManager.createOutput` new file) We now push that TreeSet on the stack: `imports.push(new TreeSet<>())` At the end of the block, that is popped. This keeps the imports scoped to releveant generators. All those generators now `peek()` at the current `TreeSet`.
neomantra
added a commit
to neomantra/simple-binary-encoding
that referenced
this issue
May 13, 2021
Too many tokens were passed to `generateComposite` causing weird errors like(real-logic#844 and real-logic#849).
mjpt777
pushed a commit
that referenced
this issue
May 14, 2021
* [Go] Fix tokens passed to generateComposite (#849) Too many tokens were passed to `generateComposite` causing weird errors like(#844 and #849). * [Go] Fix Group decoder style warning The `Decode` generator for groups would produce the following code: ``` for i, _ := range o.GroupName { ``` The `gofmt` tools suggest [simplify range expression](https://github.com/golang/tools/blob/master/internal/lsp/analysis/simplifyrange/simplifyrange.go#L23): ``` A range of the form: for x, _ = range v {...} will be simplified to: for x = range v {...} ``` This patch fixes that.
Was this fixed by the PRs? |
Yes, I will close these issues, thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found a fragility in the SbeTool generator for Golang. I got it to a simple reproducible case.
Process the following schema with
java -Dsbe.target.language=Golang -jar sbe-all-1.22.0.jar golang_bug.xml
and it will succeed... it will also succeed on all the other generators:Change
<type name="abcd"
to<type name="abcde"
and it will fail with this exception:Change
<type name="abcd"
to<type name="abcdef"
and it will succeed!Or keep
<type name="abcd"
and change to<type name="wxyz"
to<type name="wxy"
and it will also fail.Relevant code link is here:
https://github.com/real-logic/simple-binary-encoding/blob/1.22.0/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java#L2019
The text was updated successfully, but these errors were encountered: