-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Closed
Copy link
Labels
FrozenDueToAgeSoonThis needs action soon. (recent regressions, service outages, unusual time-sensitive situations)This needs action soon. (recent regressions, service outages, unusual time-sensitive situations)help wanted
Description
I was just working on some program in a code base that uses the suffix Id
for a field,
but assigning from an struct from another codebase that uses ID
instead.
For example given https://play.golang.org/p/9FAMV7mLZE
package main
type it struct {
ID string
}
func main() {
i1 := &it{"Foo"}
if i1.Id != "" {
}
i2 := &it{Id: "Bar"}
}
on trying to compile it I get
tmp/sandbox912846952/main.go:9:7: i1.Id undefined (type *it has no field or method Id, but does have ID)
tmp/sandbox912846952/main.go:11:14: unknown field 'Id' in struct literal of type it
Notice the nice hint on line 9 i1.Id undefined (type *it has no field or method Id, but does have ID)
it would be nice(though lengthy) to give a hint on line 14 such as
tmp/sandbox000177384/main.go:11:14: unknown field 'Id' in struct literal of type it (but does have ID)
/cc compiler squad @mdempsky @griesemer @randall77 @rsc.
This is a super low priority issue that I can work on when free(or anyone else is welcome too), ideas and vetoes welcome.
Metadata
Metadata
Assignees
Labels
FrozenDueToAgeSoonThis needs action soon. (recent regressions, service outages, unusual time-sensitive situations)This needs action soon. (recent regressions, service outages, unusual time-sensitive situations)help wanted