• Emmanuel T Odeke's avatar
    cmd/compile: fix label redefinition error column numbers · 0b63086f
    Emmanuel T Odeke authored
    Ensure that label redefinition error column numbers
    print the actual start of the label instead of the
    position of the label's delimiting token ":".
    
    For example, given this program:
    
    package main
    
    func main() {
    
                foo:
       foo:
    foo:
    foo            :
    }
    
    * Before:
    main.go:5:13: label foo defined and not used
    main.go:6:7: label foo already defined at main.go:5:13
    main.go:7:4: label foo already defined at main.go:5:13
    main.go:8:16: label foo already defined at main.go:5:13
    
    * After:
    main.go:5:13: label foo defined and not used
    main.go:6:4: label foo already defined at main.go:5:13
    main.go:7:1: label foo already defined at main.go:5:13
    main.go:8:1: label foo already defined at main.go:5:13
    
    Fixes #26411
    
    Change-Id: I8eb874b97fdc8862547176d57ac2fa0f075f2367
    Reviewed-on: https://go-review.googlesource.com/c/124595
    Run-TryBot: Emmanuel Odeke <emm.odeke@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarRobert Griesemer <gri@golang.org>
    0b63086f
issue26411.go 1.98 KB