1
0
mirror of https://github.com/golang/go synced 2024-11-20 01:44:42 -07:00

cmd/vet: shorten diagnostic about suspicious struct tag spaces

Change-Id: I112d0164df6abd9ca1df287376cf3605268385df
Reviewed-on: https://go-review.googlesource.com/78116
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Russ Cox 2017-11-14 11:27:03 -05:00
parent c8691f3ac1
commit 734487c929
2 changed files with 12 additions and 12 deletions

View File

@ -115,7 +115,7 @@ var (
errTagSyntax = errors.New("bad syntax for struct tag pair") errTagSyntax = errors.New("bad syntax for struct tag pair")
errTagKeySyntax = errors.New("bad syntax for struct tag key") errTagKeySyntax = errors.New("bad syntax for struct tag key")
errTagValueSyntax = errors.New("bad syntax for struct tag value") errTagValueSyntax = errors.New("bad syntax for struct tag value")
errTagValueSpace = errors.New("suspicious space found in struct tag value") errTagValueSpace = errors.New("suspicious space in struct tag value")
errTagSpace = errors.New("key:\"value\" pairs not separated by spaces") errTagSpace = errors.New("key:\"value\" pairs not separated by spaces")
) )

View File

@ -83,19 +83,19 @@ type DuplicateJSONFields struct {
type UnexpectedSpacetest struct { type UnexpectedSpacetest struct {
A int `json:"a,omitempty"` A int `json:"a,omitempty"`
B int `json:"b, omitempty"` // ERROR "suspicious space found in struct tag value" B int `json:"b, omitempty"` // ERROR "suspicious space in struct tag value"
C int `json:"c ,omitempty"` C int `json:"c ,omitempty"`
D int `json:"d,omitempty, string"` // ERROR "suspicious space found in struct tag value" D int `json:"d,omitempty, string"` // ERROR "suspicious space in struct tag value"
E int `xml:"e local"` E int `xml:"e local"`
F int `xml:"f "` // ERROR "suspicious space found in struct tag value" F int `xml:"f "` // ERROR "suspicious space in struct tag value"
G int `xml:" g"` // ERROR "suspicious space found in struct tag value" G int `xml:" g"` // ERROR "suspicious space in struct tag value"
H int `xml:"h ,omitempty"` // ERROR "suspicious space found in struct tag value" H int `xml:"h ,omitempty"` // ERROR "suspicious space in struct tag value"
I int `xml:"i, omitempty"` // ERROR "suspicious space found in struct tag value" I int `xml:"i, omitempty"` // ERROR "suspicious space in struct tag value"
J int `xml:"j local ,omitempty"` // ERROR "suspicious space found in struct tag value" J int `xml:"j local ,omitempty"` // ERROR "suspicious space in struct tag value"
K int `xml:"k local, omitempty"` // ERROR "suspicious space found in struct tag value" K int `xml:"k local, omitempty"` // ERROR "suspicious space in struct tag value"
L int `xml:" l local,omitempty"` // ERROR "suspicious space found in struct tag value" L int `xml:" l local,omitempty"` // ERROR "suspicious space in struct tag value"
M int `xml:"m local,omitempty"` // ERROR "suspicious space found in struct tag value" M int `xml:"m local,omitempty"` // ERROR "suspicious space in struct tag value"
N int `xml:" "` // ERROR "suspicious space found in struct tag value" N int `xml:" "` // ERROR "suspicious space in struct tag value"
O int `xml:""` O int `xml:""`
P int `xml:","` P int `xml:","`
Q int `foo:" doesn't care "` Q int `foo:" doesn't care "`