-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.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.gopls/parsingIssues related to parsing / poor parser recovery.Issues related to parsing / poor parser recovery.
Milestone
Description
Go version
go version go1.22.5 linux/amd64 & golang.org/x/tools/gopls v0.16.1
Output of go env in your module/workspace:
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/ren/.cache/go-build'
GOENV='/home/ren/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/ren/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/ren/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.22.5'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/ren/dev/experiments/http/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1814768367=/tmp/go-build -gno-record-gcc-switches'What did you do?
Using Rename Symbol on the first attrs to rename to fhAttrs in the function below, results in the other usage of the symbol to be changed to afhAttrs0]
package main
import (
"log/slog"
)
func Log(log *slog.Logger, buf []byte) {
attrs := []slog.Attr{
0: {Key: "len"},
}
if len(buf) < 9 {
log.
}
attrs[0].Value = slog.IntValue(len(buf))
}
What did you see happen?
package main
import (
"log/slog"
)
func Log(log *slog.Logger, buf []byte) {
fhAttrs := []slog.Attr{
0: {Key: "len"},
}
if len(buf) < 9 {
log.
}
afhAttrs0].Value = slog.IntValue(len(buf))
}
What did you expect to see?
Either fail to rename the symbol due to the syntax error, or work as expected.
Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.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.gopls/parsingIssues related to parsing / poor parser recovery.Issues related to parsing / poor parser recovery.