Skip to content

Conversation

@volodimyr
Copy link

}

envVarsList := lo.Map(container.Details.Config.Env, func(envVar string, _ int) []string {
envVars := container.Details.Config.Env

Choose a reason for hiding this comment

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

envVars := container.Details.Config.Env creates a reference to the same underlying array.
sort.Strings(envVars) sorts in place, so it also sorts container.Details.Config.Env.
This mutates the original data, which is risky even if it's only used for display.

As the code mutates the original slice. Please create a copy before sorting

Copy link

@manascb1344 manascb1344 left a comment

Choose a reason for hiding this comment

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

mentioned suggestion in comment

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