Skip to content

Commit

Permalink
Merge pull request vmware-tanzu#6154 from kaovilai/govet
Browse files Browse the repository at this point in the history
fix go vet warnings
  • Loading branch information
blackpiglet authored Apr 25, 2023
2 parents b38ee8a + b7d1c3e commit 980106d
Show file tree
Hide file tree
Showing 38 changed files with 322 additions and 237 deletions.
5 changes: 3 additions & 2 deletions golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ linters-settings:
# reason: "testing if blocked version constraint works." # Reason why the version constraint exists. (Optional)
govet:
# report about shadowed variables
check-shadowing: true
# check-shadowing: true

# settings per analyzer
settings:
Expand Down Expand Up @@ -296,6 +296,7 @@ linters:
- goheader
- goimports
- gosec
- govet
- misspell
- typecheck
- unparam
Expand Down Expand Up @@ -342,4 +343,4 @@ severity:
rules:
- linters:
- dupl
severity: info
severity: info
72 changes: 36 additions & 36 deletions internal/hook/item_hook_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ func TestGetPodExecRestoreHookFromAnnotations(t *testing.T) {
expected: &velerov1api.ExecRestoreHook{
Command: []string{"/usr/bin/foo"},
Container: "my-app",
ExecTimeout: metav1.Duration{0},
ExecTimeout: metav1.Duration{Duration: 0},
},
},
{
Expand All @@ -805,7 +805,7 @@ func TestGetPodExecRestoreHookFromAnnotations(t *testing.T) {
expected: &velerov1api.ExecRestoreHook{
Command: []string{"/usr/bin/foo"},
Container: "my-app",
ExecTimeout: metav1.Duration{0},
ExecTimeout: metav1.Duration{Duration: 0},
},
},
}
Expand Down Expand Up @@ -856,8 +856,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand Down Expand Up @@ -886,8 +886,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand All @@ -905,8 +905,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand All @@ -926,8 +926,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand All @@ -944,8 +944,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Exec: &velerov1api.ExecRestoreHook{
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand All @@ -965,8 +965,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand All @@ -984,8 +984,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container2",
Command: []string{"/usr/bin/bar"},
OnError: velerov1api.HookErrorModeFail,
ExecTimeout: metav1.Duration{time.Hour},
WaitTimeout: metav1.Duration{time.Hour},
ExecTimeout: metav1.Duration{Duration: time.Hour},
WaitTimeout: metav1.Duration{Duration: time.Hour},
},
},
},
Expand All @@ -1012,8 +1012,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand Down Expand Up @@ -1053,8 +1053,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
},
Expand All @@ -1075,26 +1075,26 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeFail,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
{
Exec: &velerov1api.ExecRestoreHook{
Container: "container2",
Command: []string{"/usr/bin/baz"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second * 3},
WaitTimeout: metav1.Duration{time.Second * 3},
ExecTimeout: metav1.Duration{Duration: time.Second * 3},
WaitTimeout: metav1.Duration{Duration: time.Second * 3},
},
},
{
Exec: &velerov1api.ExecRestoreHook{
Container: "container1",
Command: []string{"/usr/bin/bar"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second * 2},
WaitTimeout: metav1.Duration{time.Minute * 2},
ExecTimeout: metav1.Duration{Duration: time.Second * 2},
WaitTimeout: metav1.Duration{Duration: time.Minute * 2},
},
},
},
Expand All @@ -1108,8 +1108,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/aaa"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second * 4},
WaitTimeout: metav1.Duration{time.Minute * 4},
ExecTimeout: metav1.Duration{Duration: time.Second * 4},
WaitTimeout: metav1.Duration{Duration: time.Minute * 4},
},
},
},
Expand All @@ -1129,8 +1129,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/foo"},
OnError: velerov1api.HookErrorModeFail,
ExecTimeout: metav1.Duration{time.Second},
WaitTimeout: metav1.Duration{time.Minute},
ExecTimeout: metav1.Duration{Duration: time.Second},
WaitTimeout: metav1.Duration{Duration: time.Minute},
},
},
{
Expand All @@ -1140,8 +1140,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/bar"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second * 2},
WaitTimeout: metav1.Duration{time.Minute * 2},
ExecTimeout: metav1.Duration{Duration: time.Second * 2},
WaitTimeout: metav1.Duration{Duration: time.Minute * 2},
},
},
{
Expand All @@ -1151,8 +1151,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container1",
Command: []string{"/usr/bin/aaa"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second * 4},
WaitTimeout: metav1.Duration{time.Minute * 4},
ExecTimeout: metav1.Duration{Duration: time.Second * 4},
WaitTimeout: metav1.Duration{Duration: time.Minute * 4},
},
},
},
Expand All @@ -1164,8 +1164,8 @@ func TestGroupRestoreExecHooks(t *testing.T) {
Container: "container2",
Command: []string{"/usr/bin/baz"},
OnError: velerov1api.HookErrorModeContinue,
ExecTimeout: metav1.Duration{time.Second * 3},
WaitTimeout: metav1.Duration{time.Second * 3},
ExecTimeout: metav1.Duration{Duration: time.Second * 3},
WaitTimeout: metav1.Duration{Duration: time.Second * 3},
},
},
},
Expand Down
Loading

0 comments on commit 980106d

Please sign in to comment.