Skip to content

x/tools/go/analysis/passes/sortslice: false diagnostic when sort.Slice args are from a call returning two correct values #55098

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

Closed
paxan opened this issue Sep 15, 2022 · 1 comment
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@paxan
Copy link

paxan commented Sep 15, 2022

What version of Go are you using (go version)?

$ go version
go version go1.19.1 darwin/arm64

Does this issue reproduce with the latest release?

yes

What did you do?

package main

import "sort"

func main() {
	s := []string{"a", "z", "ooo"}
	sort.Slice(less(s))
}

func less(s []string) ([]string, func(i, j int) bool) {
	return s, func(i, j int) bool {
		return s[i] < s[j]
	}
}

What did you expect to see?

No diagnostic message about the first argument to sort.Slice

What did you see instead?

My editor highlights the sort.Slice with a warning:

sortslice: sort.Slice's argument must be a slice; is called with ([]string, func(i int, j int) bool)

@paxan paxan changed the title go/analysis/passes/sortslice: false diagnostic when sort.Slice args are from a call returning two correct values x/tools/go/analysis/passes/sortslice: false diagnostic when sort.Slice args are from a call returning two correct values Sep 15, 2022
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Sep 15, 2022
@gopherbot gopherbot added this to the Unreleased milestone Sep 15, 2022
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/431295 mentions this issue: go/analysis/passes/sortslice: correct diagnostic for sort.Slice(f())

@cherrymui cherrymui added the NeedsFix The path to resolution is known, but the work has not been done. label Sep 19, 2022
@golang golang locked and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants