-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Closed
Labels
ToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.
Milestone
Description
gopls version
v0.18.1
go env
-What did you do?
package main
import "fmt"
func main() {
var s = []string{"a", "b", "c"}
var i uint32 = 1
s = append(s[:i], s[i+1:]...)
fmt.Println(s) // [a c]
}go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@latest -fix ./...
What did you see happen?
package main
import "slices"
import "fmt"
func main() {
var s = []string{"a", "b", "c"}
var i uint32 = 1
s = slices.Delete(s, i, i+1)
fmt.Println(s)
}go build
./main.go:11:23: cannot use i (variable of type uint32) as int value in argument to slices.Delete
./main.go:11:26: cannot use i + 1 (value of type uint32) as int value in argument to slices.Delete
What did you expect to see?
That the change wasn't suggested in this case (or possibly with a cast to make it work? I haven't thought much about that).
This issue also encountered when running modernize against OPA, specifically here.
Editor and settings
No response
Logs
No response
Metadata
Metadata
Assignees
Labels
ToolProposalIssues describing a requested change to a Go tool or command-line program.Issues describing a requested change to a Go tool or command-line program.ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.