Skip to content

cmd/compile, go/types2: for case sensitive mismatches in function/method/attribute lookups please suggest "but does have $<CASE_INSENSITIVE_EQUIVALENT>" #70549

@odeke-em

Description

@odeke-em

Go version

go version devel go1.24-2b33434287 Fri Nov 8 01:06:04 2024 +0000 linux/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOAUTH='netrc'
GOBIN='/home/emmanuel/go/src/go.googlesource.com/go/bin'
GOCACHE='/home/emmanuel/.cache/go-build'
GOENV='/home/emmanuel/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/emmanuel/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/emmanuel/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/home/emmanuel/go/src/go.googlesource.com/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/emmanuel/go/src/go.googlesource.com/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='devel go1.24-2b33434287 Fri Nov 8 01:06:04 2024 +0000'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/emmanuel/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/emmanuel/go/src/github.com/googleapis/google-cloud-go/spanner/go.mod'
GOWORK='/home/emmanuel/go/src/github.com/googleapis/google-cloud-go/go.work'
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-build825742400=/tmp/go-build -gno-record-gcc-switches'

What did you do?

While working on some terse library with a ton of symbols/functions, in which the nomenclature for a bunch of symbols at times defies expectations in case, I had such code

// Add a unaryClientInterceptor and streamClientInterceptor.
        reqIDInjector := new(requestIDHeaderInjector)
        opts = append(opts,
            option.WithGRPCDialOption(grpc.WithchainStreamInterceptor(reqIDInjector.interceptStream)),
            option.WithGRPCDialOption(grpc.WithchainUnaryInterceptor(reqIDInjector.interceptUnary)),
        )

to reference https://pkg.go.dev/google.golang.org/grpc#WithChainStreamInterceptor and https://pkg.go.dev/google.golang.org/grpc#WithChainUnaryInterceptor

What did you see happen?

$ go test -run=TestRequestID
# cloud.google.com/go/spanner [cloud.google.com/go/spanner.test]
./client.go:414:35: undefined: grpc.WithchainStreamInterceptor
./client.go:415:35: undefined: grpc.WithchainUnaryInterceptor
FAIL	cloud.google.com/go/spanner [build failed]

What did you expect to see?

$ go test -run=TestRequestID
# cloud.google.com/go/spanner [cloud.google.com/go/spanner.test]
./client.go:414:35: undefined: grpc.WithchainStreamInterceptor, did you mean "grpc.WithChainStreamInterceptor"?
./client.go:415:35: undefined: grpc.WithchainUnaryInterceptor, did you mean "grpc.WithChainUnaryInterceptor"?
FAIL	cloud.google.com/go/spanner [build failed]

If there is a case insensitve mismatch, kindly please suggest the first one so that the user can trivially fix their code instead of
having to eye-ball to figure out their typo.

Metadata

Metadata

Labels

FrozenDueToAgeNeedsFixThe path to resolution is known, but the work has not been done.compiler/runtimeIssues related to the Go compiler and/or runtime.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions