From d9090645c36bff8f60468fda4f3129c4d8bcd5fe Mon Sep 17 00:00:00 2001 From: Kir Kolyshkin Date: Sat, 29 Mar 2025 19:57:36 -0700 Subject: [PATCH] pkg/machine: fix various linter warnings Signed-off-by: Kir Kolyshkin --- pkg/machine/define/vmtype_test.go | 1 - pkg/machine/e2e/config_init_test.go | 2 +- pkg/machine/machine_windows.go | 5 +---- pkg/machine/qemu/machine_windows.go | 5 +---- pkg/machine/wsl/declares.go | 1 - 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/pkg/machine/define/vmtype_test.go b/pkg/machine/define/vmtype_test.go index 22c816e65e..8a97cb3053 100644 --- a/pkg/machine/define/vmtype_test.go +++ b/pkg/machine/define/vmtype_test.go @@ -1,5 +1,4 @@ //go:build (amd64 && !windows) || (arm64 && !windows) -// +build amd64,!windows arm64,!windows package define diff --git a/pkg/machine/e2e/config_init_test.go b/pkg/machine/e2e/config_init_test.go index 23d25ec6e7..39911a5db4 100644 --- a/pkg/machine/e2e/config_init_test.go +++ b/pkg/machine/e2e/config_init_test.go @@ -162,7 +162,7 @@ func (i *initMachine) withRunPlaybook(p string) *initMachine { return i } -func (i *initMachine) withUserModeNetworking(r bool) *initMachine { //nolint:unused +func (i *initMachine) withUserModeNetworking(r bool) *initMachine { //nolint:unused,nolintlint i.userModeNetworking = r return i } diff --git a/pkg/machine/machine_windows.go b/pkg/machine/machine_windows.go index 4a9fde2783..3ea059f39b 100644 --- a/pkg/machine/machine_windows.go +++ b/pkg/machine/machine_windows.go @@ -130,10 +130,7 @@ func launchWinProxy(opts WinProxyOpts) (bool, string, error) { return false, "", fmt.Errorf("could not start api proxy since expected pipe is not available: %s", machinePipe) } - globalName := false - if PipeNameAvailable(GlobalNamedPipe, GlobalNameWait) { - globalName = true - } + globalName := PipeNameAvailable(GlobalNamedPipe, GlobalNameWait) command, err := FindExecutablePeer(winSSHProxy) if err != nil { diff --git a/pkg/machine/qemu/machine_windows.go b/pkg/machine/qemu/machine_windows.go index 03715c1ae1..763f9bd16a 100644 --- a/pkg/machine/qemu/machine_windows.go +++ b/pkg/machine/qemu/machine_windows.go @@ -12,10 +12,7 @@ import ( ) func isProcessAlive(pid int) bool { - if checkProcessStatus("process", pid, nil) == nil { - return true - } - return false + return checkProcessStatus("process", pid, nil) == nil } func checkProcessStatus(processHint string, pid int, stderrBuf *bytes.Buffer) error { diff --git a/pkg/machine/wsl/declares.go b/pkg/machine/wsl/declares.go index bbc4215a7e..d801eb6f36 100644 --- a/pkg/machine/wsl/declares.go +++ b/pkg/machine/wsl/declares.go @@ -24,7 +24,6 @@ const registriesConf = `unqualified-search-registries=["docker.io"] const appendPort = `grep -q Port\ %d /etc/ssh/sshd_config || echo Port %d >> /etc/ssh/sshd_config` -//nolint:unused const changePort = `sed -E -i 's/^Port[[:space:]]+[0-9]+/Port %d/' /etc/ssh/sshd_config` const configServices = `ln -fs /usr/lib/systemd/system/sshd.service /etc/systemd/system/multi-user.target.wants/sshd.service