This test verifies the fix for golang/go#44813: extraction failure when there
are blank identifiers.
-- go.mod --
module mod.test/extract
go 1.18
-- p.go --
package extract
import "fmt"
func main() {
x := []rune{} //@codeaction("x", "refactor.extract.function", end=end, result=ext)
s := "HELLO"
for _, c := range s {
x = append(x, c)
} //@loc(end, "}")
fmt.Printf("%x\n", x)
}
-- @ext/p.go --
package extract
import "fmt"
func main() {
x := newFunction() //@loc(end, "}")
fmt.Printf("%x\n", x)
}
func newFunction() []rune {
x := []rune{} //@codeaction("x", "refactor.extract.function", end=end, result=ext)
s := "HELLO"
for _, c := range s {
x = append(x, c)
}
return x
}