1
0
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:
Sarthak S. Waghmare
2025-08-16 01:00:40 +05:30
committed by GitHub
parent 9d600b6df1
commit f07a47a1bf
5 changed files with 36 additions and 2 deletions

View File

@@ -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/
}