Closed
Description
gopls version
v14.2
go env
unimportant
What did you do?
In the following example, select all main function body, then toggle "Extract function"
func main() {
var s []string
slices.SortFunc(s, func(a, b string) int {
return cmp.Compare(a, b)
})
println(s)
}
What did you expect to see?
func main() {
newFunction()
}
func newFunction() {
var s []string
slices.SortFunc(s, func(a, b string) int {
return cmp.Compare(a, b)
})
println(s)
}
What did you see instead?
func main() {
shouldReturn := newFunction()
if shouldReturn {
return
}
}
func newFunction() bool {
var s []string
slices.SortFunc(s, func(a, b string) int {
return true, cmp.Compare(a, b)
})
println(s)
return false
}
Editor and settings
No response
Logs
No response