]> Cypherpunks repositories - gostls13.git/commit
cmd/vet: check embedded field tags too
authorDaniel Martí <mvdan@mvdan.cc>
Fri, 1 Jun 2018 11:17:41 +0000 (12:17 +0100)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 23 Aug 2018 19:22:43 +0000 (19:22 +0000)
commit4b439e41e2cdd78e0eeed05942c93364c5d99b6b
tree8c90d96b638d5a8bf654b4c2fcf03b1d8da92715
parente897d43c37c353a35f211384058475a5093f1adf
cmd/vet: check embedded field tags too

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: Alan Donovan <adonovan@google.com>
src/cmd/vet/structtag.go
src/cmd/vet/testdata/structtag.go