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

xload: Detect collisions while working with reused nested structs #36

Closed
ajatprabha opened this issue Feb 15, 2024 · 0 comments · Fixed by #43
Closed

xload: Detect collisions while working with reused nested structs #36

ajatprabha opened this issue Feb 15, 2024 · 0 comments · Fixed by #43

Comments

@ajatprabha
Copy link
Contributor

ajatprabha commented Feb 15, 2024

Overview

xload, at the moment, does not detect any collisions when working with nested structs that are reused.

Example

type A struct {
	B D `env:",prefix=D_"`
	C D `env:",prefix=D_"`
}

type D struct {
	S string `env:"S"`
}

When a loader returns "D_S: "value", both A.B.S and A.C.S are assigned value "value", without any warning, potentially introducing uncaught behaviour exceptions.

Proposal

Add some mechanism to detect collisions in the overall state of a Load call on the root struct.

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 a pull request may close this issue.

1 participant