Skip to content
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

Support struct with slice of primitives #134

Merged

Conversation

asafalima
Copy link
Contributor

No description provided.

@cristaloleg
Copy link
Member

Thanks, I will take a look tomorrow. Theoretically this should be fixed by #129 if you can test this change that would be awesome (I assume you have a (test-)case for that 😉 )

@cristaloleg cristaloleg self-requested a review October 11, 2022 21:08
@asafalima
Copy link
Contributor Author

asafalima commented Oct 11, 2022

Thanks, I will take a look tomorrow. Theoretically this should be fixed by #129 if you can test this change that would be awesome (I assume you have a (test-)case for that 😉 )

Thank you @cristaloleg, I tried to port the test I wrote to your branch but I got the same panic from mii function.

@cristaloleg
Copy link
Member

Can you share the test log, please?

@asafalima
Copy link
Contributor Author

=== RUN   TestSliceOfStructsWithSliceOfPrimitives
--- FAIL: TestSliceOfStructsWithSliceOfPrimitives (0.00s)
panic: bool true [recovered]
	panic: bool true

goroutine 68 [running]:
testing.tRunner.func1.2({0x1024f2380, 0x140001d9240})
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1389 +0x1c8
testing.tRunner.func1()
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1392 +0x384
panic({0x1024f2380, 0x140001d9240})
	/opt/homebrew/opt/go/libexec/src/runtime/panic.go:838 +0x204
github.com/cristalhq/aconfig.mii({0x1024f0e40?, 0x1025f2108?})
	/workspace/aconfig/reflection.go:395 +0x100
github.com/cristalhq/aconfig.m2s(0x10250eca0?, {0x10250eca0?, 0x140001cd3e0?, 0x1?})
	/workspace/aconfig/reflection.go:366 +0x400
github.com/cristalhq/aconfig.(*Loader).setFieldData(0x1024f9ca0?, 0x140001eca50, {0x1024efd00, 0x140001e24b0?})
	/workspace/aconfig/reflection.go:204 +0x83c
github.com/cristalhq/aconfig.(*Loader).loadFile(0x140001f1320, {0x1024acfa0, 0x2a})
	/workspace/aconfig/aconfig.go:376 +0x318
github.com/cristalhq/aconfig.(*Loader).loadFiles(0x140001f1320)
	/workspace/aconfig/aconfig.go:330 +0xfc
github.com/cristalhq/aconfig.(*Loader).loadSources(0x140001f1320)
	/workspace/aconfig/aconfig.go:265 +0x7c
github.com/cristalhq/aconfig.(*Loader).loadConfig(0x140001f1320)
	/workspace/aconfig/aconfig.go:241 +0x68
github.com/cristalhq/aconfig.(*Loader).Load(0x101000100?)
	/workspace/aconfig/aconfig.go:231 +0x6c
github.com/cristalhq/aconfig.TestSliceOfStructsWithSliceOfPrimitives(0x140001dcd00?)
	/workspace/aconfig/aconfig_test.go:1568 +0xc4
testing.tRunner(0x140001dd040, 0x102520688)
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1439 +0x110
created by testing.(*T).Run
	/opt/homebrew/opt/go/libexec/src/testing/testing.go:1486 +0x300

FAIL	github.com/cristalhq/aconfig	0.125s

@asafalima
Copy link
Contributor Author

@cristaloleg Can we push this fix to the current parser and port it later to the new parser PR?

@cristaloleg
Copy link
Member

Yeah, totally agree. Will merge & release a new version. Thanks!

@cristaloleg cristaloleg merged commit 877d9d3 into cristalhq:main Oct 13, 2022
@cristaloleg
Copy link
Member

@asafalima asafalima deleted the support-struct-with-slice-of-primitives branch October 13, 2022 11:43
@asafalima
Copy link
Contributor Author

@cristaloleg Thank you Oleg, appreciate it

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.

None yet

2 participants