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

[BUG] slices.DeleteFunc #21042

Closed
Deleplace opened this issue Nov 22, 2023 · 1 comment · Fixed by #21077
Closed

[BUG] slices.DeleteFunc #21042

Deleplace opened this issue Nov 22, 2023 · 1 comment · Fixed by #21077

Comments

@Deleplace
Copy link

Hello, while researching for this Go proposal I noticed this code:

			// remove possible paths that do not match possible platforms
			slices.DeleteFunc(possiblePaths, func(s string) bool {
				pform := strings.Split(s, string(os.PathSeparator))[0]
				return !slices.Contains(kvp.platforms, pform)
			})

which doesn't do what it seems to do, and should look like this instead:

			// remove possible paths that do not match possible platforms
			possiblePaths = slices.DeleteFunc(possiblePaths, func(s string) bool {
				pform := strings.Split(s, string(os.PathSeparator))[0]
				return !slices.Contains(kvp.platforms, pform)
			})

I have not tried to execute it.

@paulcacheux
Copy link
Contributor

@Deleplace thanks a lot for reporting this issue, you are fully right that our usage here is wrong. I opened #21077 that should fix it (and add a test for good measure). Thanks again !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants