mirror of
https://github.com/vmware-tanzu/velero.git
synced 2026-09-19 22:44:21 +00:00
Enable staticcheck and resolve found issues.
Signed-off-by: Xun Jiang <blackpiglet@gmail.com>
This commit is contained in:
@@ -105,10 +105,10 @@ func TestCreateOptions_BuildBackupFromSchedule(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestCreateOptions_OrderedResources(t *testing.T) {
|
||||
orderedResources, err := ParseOrderedResources("pods= ns1/p1; ns1/p2; persistentvolumeclaims=ns2/pvc1, ns2/pvc2")
|
||||
_, err := ParseOrderedResources("pods= ns1/p1; ns1/p2; persistentvolumeclaims=ns2/pvc1, ns2/pvc2")
|
||||
assert.NotNil(t, err)
|
||||
|
||||
orderedResources, err = ParseOrderedResources("pods= ns1/p1,ns1/p2 ; persistentvolumeclaims=ns2/pvc1,ns2/pvc2")
|
||||
orderedResources, err := ParseOrderedResources("pods= ns1/p1,ns1/p2 ; persistentvolumeclaims=ns2/pvc1,ns2/pvc2")
|
||||
assert.NoError(t, err)
|
||||
|
||||
expectedResources := map[string]string{
|
||||
|
||||
@@ -18,9 +18,10 @@ package cli
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/spf13/pflag"
|
||||
"golang.org/x/text/cases"
|
||||
"golang.org/x/text/language"
|
||||
|
||||
"github.com/vmware-tanzu/velero/pkg/cmd/util/flag"
|
||||
)
|
||||
@@ -64,6 +65,6 @@ func (o *SelectOptions) Validate() error {
|
||||
|
||||
// BindFlags binds options for this command to flags.
|
||||
func (o *SelectOptions) BindFlags(flags *pflag.FlagSet) {
|
||||
flags.BoolVar(&o.All, "all", o.All, strings.Title(o.CMD)+" all "+o.SingularTypeName+"s")
|
||||
flags.VarP(&o.Selector, "selector", "l", strings.Title(o.CMD)+" all "+o.SingularTypeName+"s matching this label selector.")
|
||||
flags.BoolVar(&o.All, "all", o.All, cases.Title(language.Und).String(o.CMD)+" all "+o.SingularTypeName+"s")
|
||||
flags.VarP(&o.Selector, "selector", "l", cases.Title(language.Und).String(o.CMD)+" all "+o.SingularTypeName+"s matching this label selector.")
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ func TestPrintVersion(t *testing.T) {
|
||||
for _, tc := range tests {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
var (
|
||||
kbClient = fake.NewFakeClientWithScheme(scheme.Scheme)
|
||||
kbClient = fake.NewClientBuilder().WithScheme(scheme.Scheme).Build()
|
||||
serverStatusGetter = new(mockServerStatusGetter)
|
||||
buf = new(bytes.Buffer)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user