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.
Go version
go version go1.22.5 linux/amd64 & golang.org/x/tools/gopls v0.16.1
Output of
go envin your module/workspace:What did you do?
Using Rename Symbol on the first
attrsto rename tofhAttrsin the function below, results in the other usage of the symbol to be changed toafhAttrs0]What did you see happen?
What did you expect to see?
Either fail to rename the symbol due to the syntax error, or work as expected.