• Daniel Martí's avatar
    cmd/vet: check embedded field tags too · 4b439e41
    Daniel Martí authored
    We can no longer use the field's position for the duplicate field tag
    warning - since we now check embedded tags, the positions may belong to
    copmletely different packages.
    
    Instead, keep track of the lowest field that's still part of the
    top-level struct type that we are checking.
    
    Finally, be careful to not repeat the independent struct field warnings
    when checking fields again because they are embedded into another
    struct. To do this, separate the duplicate tag value logic into a func
    that recurses into embedded fields on a per-encoding basis.
    
    Fixes #25593.
    
    Change-Id: I3bd6e01306d8ec63c0314d25e3136d5e067a9517
    Reviewed-on: https://go-review.googlesource.com/115677
    Run-TryBot: Daniel Martí <mvdan@mvdan.cc>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarAlan Donovan <adonovan@google.com>
    4b439e41
structtag.go 6.56 KB