Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmd/compile: misspelling by case-mismatch of field names in literal no longer shown in compiler error messages like it did in Go1.17 #65075

Closed
odeke-em opened this issue Jan 12, 2024 · 3 comments
Assignees
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@odeke-em
Copy link
Member

Go version

go version devel go1.22-1ae729e6d3 Fri Jan 5 23:38:32 2024 +0000 darwin/amd64

Output of go env in your module/workspace:

GO111MODULE=''
GOARCH='amd64'
GOBIN='/Users/emmanuelodeke/go/bin'
GOCACHE='/Users/emmanuelodeke/Library/Caches/go-build'
GOENV='/Users/emmanuelodeke/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='/Users/emmanuelodeke/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/emmanuelodeke/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/emmanuelodeke/go/src/go.googlesource.com/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/emmanuelodeke/go/src/go.googlesource.com/go/pkg/tool/darwin_amd64'
GOVCS=''
GOVERSION='devel go1.22-1ae729e6d3 Fri Jan 5 23:38:32 2024 +0000'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='/Users/emmanuelodeke/go/src/github.com/orijtech/medisa/go.mod'
GOWORK=''
CGO_CFLAGS='-I/Users/emmanuelodeke/Desktop/openSrc/rocksdb/include'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-L/Users/emmanuelodeke/Desktop/openSrc/rocksdb -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy -llz4 -lzstd'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/v3/7z434qpx5v3bw0wh8h2myfpw0000gn/T/go-build3071944846=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

I ran this program

package main

type URL struct {
	URL  string
	NSFW bool
	ID   string
}

func main() {
	_ = &URL{
		Id: "foo",
	}
}

What did you see happen?

I got back this error

./main.go:11:3: unknown field 'Id' in struct literal of type URL

What did you expect to see?

./main.go:11:3: unknown field 'Id' in struct literal of type URL (but does have ID)

which was in Go1.17 and a nicer user experience that's prescriptive

@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jan 12, 2024
@mauri870
Copy link
Member

cc @griesemer as this seems to be types2 related

@dmitshur dmitshur added this to the Backlog milestone Jan 12, 2024
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Jan 12, 2024
@gopherbot
Copy link

Change https://go.dev/cl/556235 mentions this issue: types2: add hint that there's a string-folded equivalent struct field

@mknyszek mknyszek modified the milestones: Backlog, Go1.23 Jan 17, 2024
@griesemer
Copy link
Contributor

This was fixed by CL 560055.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler/runtime Issues related to the Go compiler and/or runtime. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants