Skip to content

envconfig: fix bug where slice data is deleted#5

Open
GiedriusS wants to merge 3 commits intocolega:masterfrom
GiedriusS:master
Open

envconfig: fix bug where slice data is deleted#5
GiedriusS wants to merge 3 commits intocolega:masterfrom
GiedriusS:master

Conversation

@GiedriusS
Copy link

If nothing came through environment variables then let's leave the slice alone and recursively descend.

Comment on lines +46 to +50
{
Input: Input{
Type: "haha",
},
},
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is removed now, right?

Comment on lines +187 to +191
if l != 0 {
f.Set(reflect.MakeSlice(f.Type(), l, l))
} else {
l = f.Len()
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that we should extend the existing slice if l > f.Len(), wdyt? We could append some empty structs to it and process all env vars.

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.

2 participants