implement lint fixes

pull/14175/head
Steven Powell 2022-05-16 12:48:41 -07:00
parent b42cb3ec02
commit 53fdfb286c
3 changed files with 12 additions and 18 deletions

View File

@ -109,7 +109,7 @@ var serviceCmd = &cobra.Command{
services = newServices
}
if services == nil || len(services) == 0 {
if len(services) == 0 {
exit.Message(reason.SvcNotFound, `Service '{{.service}}' was not found in '{{.namespace}}' namespace.
You may select another namespace by using 'minikube service {{.service}} -n <namespace>'. Or list out all the services using 'minikube service list'`, out.V{"service": args[0], "namespace": namespace})
}

View File

@ -79,10 +79,8 @@ type Driver struct {
DiskPath string
CacheMode string
IOMode string
connectionString string
// conn *libvirt.Connect
// VM *libvirt.Domain
vmLoaded bool
UserDataFile string
CloudConfigRoot string
LocalPorts string
@ -275,19 +273,19 @@ func parsePortRange(rawPortRange string) (int, int, error) {
minPort, err := strconv.Atoi(portRange[0])
if err != nil {
return 0, 0, fmt.Errorf("Invalid port range")
return 0, 0, fmt.Errorf("invalid port range")
}
maxPort, err := strconv.Atoi(portRange[1])
if err != nil {
return 0, 0, fmt.Errorf("Invalid port range")
return 0, 0, fmt.Errorf("invalid port range")
}
if maxPort < minPort {
return 0, 0, fmt.Errorf("Invalid port range")
return 0, 0, fmt.Errorf("invalid port range")
}
if maxPort-minPort < 2 {
return 0, 0, fmt.Errorf("Port range must be minimum 2 ports")
return 0, 0, fmt.Errorf("port range must be minimum 2 ports")
}
return minPort, maxPort, nil
@ -327,7 +325,7 @@ func getAvailableTCPPortFromRange(minPort int, maxPort int) (int, error) {
port = p
return port, nil
}
time.Sleep(1)
time.Sleep(1 * time.Second)
}
return 0, fmt.Errorf("unable to allocate tcp port")
}
@ -368,9 +366,8 @@ func (d *Driver) Start() error {
startCmd = append(startCmd,
"-display", d.DisplayType,
)
} else {
// Use the default graphic output
}
// else use the default graphic output
} else {
if d.Nographic {
startCmd = append(startCmd,

View File

@ -49,7 +49,7 @@ import (
"github.com/blang/semver/v4"
"github.com/elazarl/goproxy"
"github.com/hashicorp/go-retryablehttp"
"github.com/otiai10/copy"
cp "github.com/otiai10/copy"
"github.com/phayes/freeport"
"github.com/pkg/errors"
"golang.org/x/build/kubernetes/api"
@ -480,10 +480,7 @@ func validateDockerEnv(ctx context.Context, t *testing.T, profile string) {
defer cancel()
command := make([]string, len(tc.commandPrefix)+1)
// Would use "copy" built-in here, but that is shadowed by "copy" package
for i, v := range tc.commandPrefix {
command[i] = v
}
copy(command, tc.commandPrefix)
formattedArg := fmt.Sprintf(tc.formatArg, Target(), profile)
@ -1783,7 +1780,7 @@ func setupFileSync(ctx context.Context, t *testing.T, profile string) {
p := localSyncTestPath()
t.Logf("local sync path: %s", p)
syncFile := filepath.Join(*testdataDir, "sync.test")
err := copy.Copy(syncFile, p)
err := cp.Copy(syncFile, p)
if err != nil {
t.Fatalf("failed to copy testdata/sync.test: %v", err)
}
@ -1792,7 +1789,7 @@ func setupFileSync(ctx context.Context, t *testing.T, profile string) {
// Write to a temp file for an atomic write
tmpPem := localTestCertPath() + ".pem"
if err := copy.Copy(testPem, tmpPem); err != nil {
if err := cp.Copy(testPem, tmpPem); err != nil {
t.Fatalf("failed to copy %s: %v", testPem, err)
}
@ -1816,7 +1813,7 @@ func setupFileSync(ctx context.Context, t *testing.T, profile string) {
testPem2 := filepath.Join(*testdataDir, "minikube_test2.pem")
tmpPem2 := localTestCertFilesPath() + ".pem"
if err := copy.Copy(testPem2, tmpPem2); err != nil {
if err := cp.Copy(testPem2, tmpPem2); err != nil {
t.Fatalf("failed to copy %s: %v", testPem2, err)
}