• Emmanuel Odeke's avatar
    cmd/compile: improve error message for unknown fields in structs · 7b454565
    Emmanuel Odeke authored
    Improves the error message by moving the field name before the body
    of a struct, in the error message for unknown fields for structs.
    
    * Exhibit:
    Given program:
    
    package main
    
    import "time"
    
    func main() {
      _ = struct {
        about      string
        before     map[string]uint
        update     map[string]int
        updateTime time.Time
        expect     map[string]int
      }{
        about:   "this one",
        updates: map[string]int{"gopher": 10},
      }
    }
    
    * Before:
    ./issue17631.go:20: unknown struct { about string; before map[string]uint;
     update map[string]int; updateTime time.Time; expect map[string]int } field
    'updates' in struct literal
    
    * After:
    ./issue17631.go:20: unknown field 'updates' in struct literal of type { about string;
    before map[string]uint; update map[string]int; updateTime time.Time;
    expect map[string]int }
    
    Fixes #17631
    
    Change-Id: I76842616411b931b5ad7a76bd42860dfde7739f4
    Reviewed-on: https://go-review.googlesource.com/32240Reviewed-by: 's avatarJosh Bleecher Snyder <josharian@gmail.com>
    7b454565
Name
Last commit
Last update
..
addr2line Loading commit data...
api Loading commit data...
asm Loading commit data...
cgo Loading commit data...
compile Loading commit data...
cover Loading commit data...
dist Loading commit data...
doc Loading commit data...
fix Loading commit data...
go Loading commit data...
gofmt Loading commit data...
internal Loading commit data...
link Loading commit data...
nm Loading commit data...
objdump Loading commit data...
pack Loading commit data...
pprof Loading commit data...
trace Loading commit data...
vendor Loading commit data...
vet Loading commit data...