Skip to content

Commit

Permalink
test: use private members to make linters happy (#6624)
Browse files Browse the repository at this point in the history
Fixing:
```
pkg/config/struct_keys_test.go:63:3: field c is unused (U1000)
pkg/config/struct_keys_test.go:237:3: field c is unused (U1000)
```
  • Loading branch information
nopcoder authored Sep 20, 2023
1 parent e036ddf commit 51e719a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/config/struct_keys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func TestStructKeys_SimpleTagged(t *testing.T) {
B int `toast:"bee"`
c int `test:"ccc" toast:"sea"`
}
// make sure we use the struct as it holds private members
_ = s{A: 1, B: 2, c: 3}

keys := config.GetStructKeys(reflect.TypeOf(s{}), tagName, squashTagValue)
if diffs := deep.Equal(keys, []string{"Aaa", "b", "ccc"}); diffs != nil {
Expand Down Expand Up @@ -236,6 +238,8 @@ func TestValidateMissingRequired_SimpleTagged(t *testing.T) {
B int `toast:"bee" validate:"required"`
c int `test:"ccc" toast:"sea" validate:"required"`
}
// make sure we use the struct as it holds private members
_ = s{A: 1, B: 2, c: 3}

keys := config.ValidateMissingRequiredKeys(s{}, tagName, squashTagValue)
if diffs := deep.Equal(keys, []string{"Aaa", "b", "ccc"}); diffs != nil {
Expand Down

0 comments on commit 51e719a

Please sign in to comment.