mirror of https://github.com/kubernetes/kops.git
cmd/kops/ staticcheck and remove one mom
This commit is contained in:
parent
81d4cf62a1
commit
6d584b63d6
|
|
@ -217,7 +217,7 @@ func RunReplace(f *util.Factory, cmd *cobra.Command, out io.Writer, c *replaceOp
|
|||
}
|
||||
default:
|
||||
klog.V(2).Infof("Type of object was %T", v)
|
||||
return fmt.Errorf("Unhandled kind %q in %q", gvk, f)
|
||||
return fmt.Errorf("unhandled kind %q in %q", gvk, f)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -221,7 +221,7 @@ func (c *RootCmd) ProcessArgs(args []string) error {
|
|||
fmt.Printf("For example: use `--bastion=true` or `--bastion`, not `--bastion true`\n\n")
|
||||
|
||||
if len(args) == 1 {
|
||||
return fmt.Errorf("Cannot specify cluster via --name and positional argument")
|
||||
return fmt.Errorf("cannot specify cluster via --name and positional argument")
|
||||
}
|
||||
return fmt.Errorf("expected a single <clustername> to be passed as an argument")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ func NewCmdToolboxBundle(f *util.Factory, out io.Writer) *cobra.Command {
|
|||
|
||||
func RunToolboxBundle(context Factory, out io.Writer, options *ToolboxBundleOptions, args []string) error {
|
||||
if len(args) == 0 {
|
||||
return fmt.Errorf("Specify name of instance group for node")
|
||||
return fmt.Errorf("specify name of instance group for node")
|
||||
}
|
||||
if len(args) != 1 {
|
||||
return fmt.Errorf("Can only specify one instance group")
|
||||
return fmt.Errorf("can only specify one instance group")
|
||||
}
|
||||
|
||||
if options.Target == "" {
|
||||
|
|
|
|||
|
|
@ -132,18 +132,18 @@ func RunToolboxConvertImported(f *util.Factory, out io.Writer, options *ToolboxC
|
|||
|
||||
// TODO: Switch to cloudup.BuildCloud
|
||||
if len(cluster.Spec.Subnets) == 0 {
|
||||
return fmt.Errorf("Configuration must include Subnets")
|
||||
return fmt.Errorf("configuration must include Subnets")
|
||||
}
|
||||
|
||||
region := ""
|
||||
for _, subnet := range cluster.Spec.Subnets {
|
||||
if len(subnet.Name) <= 2 {
|
||||
return fmt.Errorf("Invalid AWS zone: %q", subnet.Zone)
|
||||
return fmt.Errorf("invalid AWS zone: %q", subnet.Zone)
|
||||
}
|
||||
|
||||
zoneRegion := subnet.Zone[:len(subnet.Zone)-1]
|
||||
if region != "" && zoneRegion != region {
|
||||
return fmt.Errorf("Clusters cannot span multiple regions")
|
||||
return fmt.Errorf("clusters cannot span multiple regions")
|
||||
}
|
||||
|
||||
region = zoneRegion
|
||||
|
|
|
|||
|
|
@ -142,6 +142,6 @@ func RunToolboxDump(f *util.Factory, out io.Writer, options *ToolboxDumpOptions)
|
|||
return nil
|
||||
|
||||
default:
|
||||
return fmt.Errorf("Unsupported output format: %q", options.Output)
|
||||
return fmt.Errorf("unsupported output format: %q", options.Output)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,7 @@ func RunUpdateCluster(f *util.Factory, clusterName string, out io.Writer, c *Upd
|
|||
for _, override := range c.LifecycleOverrides {
|
||||
values := strings.Split(override, "=")
|
||||
if len(values) != 2 {
|
||||
return results, fmt.Errorf("Incorrect syntax for lifecyle-overrides, correct syntax is TaskName=lifecycleName, override provided: %q", override)
|
||||
return results, fmt.Errorf("incorrect syntax for lifecyle-overrides, correct syntax is TaskName=lifecycleName, override provided: %q", override)
|
||||
}
|
||||
|
||||
taskName := values[0]
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ func (f *Factory) Clientset() (simple.Clientset, error) {
|
|||
} else {
|
||||
u, err := url.Parse(registryPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Invalid kops server url: %q", registryPath)
|
||||
return nil, fmt.Errorf("invalid kops server url: %q", registryPath)
|
||||
}
|
||||
configOverrides.CurrentContext = u.Host
|
||||
}
|
||||
|
|
|
|||
|
|
@ -136,12 +136,12 @@ func RunValidateCluster(f *util.Factory, cmd *cobra.Command, args []string, out
|
|||
configLoadingRules,
|
||||
&clientcmd.ConfigOverrides{CurrentContext: contextName}).ClientConfig()
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Cannot load kubecfg settings for %q: %v", contextName, err)
|
||||
return nil, fmt.Errorf("cannot load kubecfg settings for %q: %v", contextName, err)
|
||||
}
|
||||
|
||||
k8sClient, err := kubernetes.NewForConfig(config)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Cannot build kubernetes api client for %q: %v", contextName, err)
|
||||
return nil, fmt.Errorf("cannot build kubernetes api client for %q: %v", contextName, err)
|
||||
}
|
||||
|
||||
timeout := time.Now().Add(options.wait)
|
||||
|
|
@ -188,7 +188,7 @@ func RunValidateCluster(f *util.Factory, cmd *cobra.Command, args []string, out
|
|||
}
|
||||
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown output format: %q", options.output)
|
||||
return nil, fmt.Errorf("unknown output format: %q", options.output)
|
||||
}
|
||||
|
||||
if options.wait == 0 || len(result.Failures) == 0 {
|
||||
|
|
@ -264,12 +264,10 @@ func validateClusterOutputTable(result *validation.ValidationCluster, cluster *a
|
|||
if err := failuresTable.Render(result.Failures, out, "KIND", "NAME", "MESSAGE"); err != nil {
|
||||
return fmt.Errorf("error rendering failures table: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if len(result.Failures) == 0 {
|
||||
fmt.Fprintf(out, "\nYour cluster %s is ready\n", cluster.Name)
|
||||
fmt.Fprintf(out, "\nValidation Failed\n")
|
||||
} else {
|
||||
fmt.Fprint(out, "\nValidation Failed\n")
|
||||
fmt.Fprintf(out, "\nYour cluster %s is ready\n", cluster.Name)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue