We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'm using the UnmarshalString and MarshalBinary function to parse an Ion string to a struct and then convert it into binary.
Works fine with the following example
var testString = ` { key1:"hello", key2:"hello", } ` var testStruct map[string]any ion.UnmarshalString(testString, &testStruct) t.Log(testStruct) var resultBinary, _ = ion.MarshalBinary(testStruct) t.Log(resultBinary)
Output
utils_test.go:303: map[key1:hello key2:hello] utils_test.go:307: [224 1 0 234 238 143 129 131 220 135 186 132 107 101 121 49 132 107 101 121 50 222 142 138 133 104 101 108 108 111 139 133 104 101 108 108 111]
However, if my Ion String contains a decimal, I notice the library runs into problems.
var testString = ` { key1:"hello", key2:1.2, } ` var testStruct map[string]any ion.UnmarshalString(testString, &testStruct) t.Log(testStruct) var resultBinary, _ = ion.MarshalBinary(testStruct) t.Log(resultBinary)
utils_test.go:303: map[key1:hello key2:{0x140001ea820 1 false}] panic: reflect.Value.Addr of unaddressable value [recovered] panic: reflect.Value.Addr of unaddressable value goroutine 6 [running]: testing.tRunner.func1.2({0x103915580, 0x103aa2f60}) /Users/wnste/brazil-pkg-cache/packages/GoLang/GoLang-1.x.338304.0/AL2_x86_64/DEV.STD.PTHREAD/build/lib/src/testing/testing.go:1632 +0x1bc testing.tRunner.func1() /Users/wnste/brazil-pkg-cache/packages/GoLang/GoLang-1.x.338304.0/AL2_x86_64/DEV.STD.PTHREAD/build/lib/src/testing/testing.go:1635 +0x334 panic({0x103915580?, 0x103aa2f60?}) /Users/wnste/brazil-pkg-cache/packages/GoLang/GoLang-1.x.338304.0/AL2_x86_64/DEV.STD.PTHREAD/build/lib/src/runtime/panic.go:785 +0x124 reflect.Value.Addr({0x1039df1c0?, 0x140002c3320?, 0x18?}) /Users/wnste/brazil-pkg-cache/packages/GoLang/GoLang-1.x.338304.0/AL2_x86_64/DEV.STD.PTHREAD/build/lib/src/reflect/value.go:268 +0x64 github.com/amazon-ion/ion-go/ion.(*Encoder).encodeDecimal(0x14000123ec8, {0x1039df1c0?, 0x140002c3320?, 0x0?}) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:453 +0x34 github.com/amazon-ion/ion-go/ion.(*Encoder).encodeStruct(0x14000123ec8, {0x1039df1c0?, 0x140002c3320?, 0x102f72180?}) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:385 +0x2b8 github.com/amazon-ion/ion-go/ion.(*Encoder).encodeValue(0x14000123ec8, {0x1039df1c0?, 0x140002c3320?, 0x103319e3c?}, 0x0) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:236 +0x608 github.com/amazon-ion/ion-go/ion.(*Encoder).encodePtr(0x14000123ec8, {0x103946cc0?, 0x140002c3430?, 0x10331a944?}, 0x0) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:258 +0xc4 github.com/amazon-ion/ion-go/ion.(*Encoder).encodeValue(0x14000123ec8, {0x103946cc0?, 0x140002c3430?, 0x103915580?}, 0x0) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:233 +0x500 github.com/amazon-ion/ion-go/ion.(*Encoder).encodeMap(0x14000123ec8, {0x10395ea40?, 0x140002b97d0?, 0x140001ea8a0?}, 0x0) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:284 +0x22c github.com/amazon-ion/ion-go/ion.(*Encoder).encodeValue(0x14000123ec8, {0x10395ea40?, 0x140002b97d0?, 0x103319b38?}, 0x0) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:239 +0x4dc github.com/amazon-ion/ion-go/ion.(*Encoder).Encode(0x103aa6060?, {0x10395ea40?, 0x140002b97d0?}) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:177 +0x84 github.com/amazon-ion/ion-go/ion.MarshalBinary({0x10395ea40, 0x140002b97d0}, {0x0, 0x0, 0x0}) /Volumes/workplace/jarviscollector/tmp/gomodcache/github.com/amazon-ion/[email protected]/ion/marshal.go:105 +0x74 golang.a2z.com/JarvisTracerExporter.TestDecimal(0x140002bed00) /Volumes/workplace/jarviscollector/src/JarvisTracerExporter/utils_test.go:305 +0xb4 testing.tRunner(0x140002bed00, 0x103a9ed68) /Users/wnste/brazil-pkg-cache/packages/GoLang/GoLang-1.x.338304.0/AL2_x86_64/DEV.STD.PTHREAD/build/lib/src/testing/testing.go:1690 +0xe4 created by testing.(*T).Run in goroutine 1 /Users/wnste/brazil-pkg-cache/packages/GoLang/GoLang-1.x.338304.0/AL2_x86_64/DEV.STD.PTHREAD/build/lib/src/testing/testing.go:1743 +0x314
Ion decimal seems to be supported based on the docs I see and example test cases in the repo. Any ideas what I may be doing wrong?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I'm using the UnmarshalString and MarshalBinary function to parse an Ion string to a struct and then convert it into binary.
Works fine with the following example
Output
However, if my Ion String contains a decimal, I notice the library runs into problems.
Output
Ion decimal seems to be supported based on the docs I see and example test cases in the repo. Any ideas what I may be doing wrong?
The text was updated successfully, but these errors were encountered: