mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
feature: support spanner struct tag in struct-tag rule (#1479)
This commit is contained in:
committed by
GitHub
parent
9d600b6df1
commit
f07a47a1bf
14
testdata/struct_tag.go
vendored
14
testdata/struct_tag.go
vendored
@@ -88,6 +88,12 @@ type TestDuplicatedProtobufTags struct {
|
||||
C int `protobuf:"varint,name=c"` // MATCH /duplicated tag name "c" in protobuf tag/
|
||||
}
|
||||
|
||||
type SpannerDuplicatedTags struct {
|
||||
A int `spanner:"field_a"`
|
||||
B int `spanner:"field_a"` // MATCH /duplicated tag name "field_a" in spanner tag/
|
||||
C int `spanner:"field_c"`
|
||||
}
|
||||
|
||||
// test case from
|
||||
// sigs.k8s.io/kustomize/api/types/helmchartargs.go
|
||||
|
||||
@@ -182,3 +188,11 @@ type PropertiesTags struct {
|
||||
Field []string `properties:",default=a;b;c"`
|
||||
Field map[string]string `properties:"myName,omitempty"` // MATCH /unknown or malformed option "omitempty" in properties tag/
|
||||
}
|
||||
|
||||
type SpannerUser struct {
|
||||
ID int `spanner:"user_id"`
|
||||
Name string `spanner:"full_name"`
|
||||
Email string `spanner:"-"` // Valid: ignore field
|
||||
CreatedAt time.Time `spanner:"created_at"`
|
||||
UpdatedAt time.Time `spanner:"updated_at,unknown"` // MATCH /unknown option "unknown" in spanner tag/
|
||||
}
|
||||
Reference in New Issue
Block a user