diff --git a/pkg/crc/adminhelper/hosts_unix.go b/pkg/crc/adminhelper/hosts_unix.go index 125083938b..0731ab9054 100644 --- a/pkg/crc/adminhelper/hosts_unix.go +++ b/pkg/crc/adminhelper/hosts_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package adminhelper diff --git a/pkg/crc/cache/cache.go b/pkg/crc/cache/cache.go index e23ae1c195..6cd2cf027f 100644 --- a/pkg/crc/cache/cache.go +++ b/pkg/crc/cache/cache.go @@ -53,7 +53,7 @@ func (c *Cache) GetExecutableName() string { * * It returns as a string */ -func getVersionGeneric(executablePath string, args ...string) (string, error) { //nolint:deadcode,unused +func getVersionGeneric(executablePath string, args ...string) (string, error) { //nolint:unused stdOut, _, err := crcos.RunWithDefaultLocale(executablePath, args...) if err != nil { logging.Debugf("failed to run executable %s: %v", executablePath, err) diff --git a/pkg/crc/daemonclient/transport_unix.go b/pkg/crc/daemonclient/transport_unix.go index 510e32b2c9..ae0efe66f6 100644 --- a/pkg/crc/daemonclient/transport_unix.go +++ b/pkg/crc/daemonclient/transport_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package daemonclient diff --git a/pkg/crc/gpg/gpg.go b/pkg/crc/gpg/gpg.go index 9e8833dfc4..8ac2af2abc 100644 --- a/pkg/crc/gpg/gpg.go +++ b/pkg/crc/gpg/gpg.go @@ -10,8 +10,8 @@ import ( "github.com/ProtonMail/go-crypto/openpgp" "github.com/crc-org/crc/v2/pkg/crc/constants" "github.com/crc-org/crc/v2/pkg/crc/logging" - goOpenpgp "golang.org/x/crypto/openpgp" //nolint - goClearsign "golang.org/x/crypto/openpgp/clearsign" //nolint + goOpenpgp "golang.org/x/crypto/openpgp" //nolint:staticcheck + goClearsign "golang.org/x/crypto/openpgp/clearsign" //nolint:staticcheck ) func Verify(filePath, signatureFilePath string) error { diff --git a/pkg/crc/machine/generate_bundle.go b/pkg/crc/machine/generate_bundle.go index 4cc05baf8d..36635b5caa 100644 --- a/pkg/crc/machine/generate_bundle.go +++ b/pkg/crc/machine/generate_bundle.go @@ -65,7 +65,11 @@ func (client *client) GenerateBundle(forceStop bool) error { if err != nil { return err } - defer copier.Cleanup() //nolint + defer func() { + if err := copier.Cleanup(); err != nil { + logging.Errorf("copier.Cleanup failed: %v", err) + } + }() customBundleDir := copier.CachedPath() if err := copier.CopyKubeConfig(); err != nil { diff --git a/pkg/crc/machine/generate_bundle_nonlinux.go b/pkg/crc/machine/generate_bundle_nonlinux.go index dbd3d312d5..de88c6549b 100644 --- a/pkg/crc/machine/generate_bundle_nonlinux.go +++ b/pkg/crc/machine/generate_bundle_nonlinux.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package machine diff --git a/pkg/crc/machine/libvirt/constants.go b/pkg/crc/machine/libvirt/constants.go index be01a0196d..253ae30021 100644 --- a/pkg/crc/machine/libvirt/constants.go +++ b/pkg/crc/machine/libvirt/constants.go @@ -1,5 +1,4 @@ //go:build linux || build -// +build linux build package libvirt diff --git a/pkg/crc/machine/start.go b/pkg/crc/machine/start.go index 58ee542a6b..bd07d6bfbe 100644 --- a/pkg/crc/machine/start.go +++ b/pkg/crc/machine/start.go @@ -746,7 +746,7 @@ func enableEmergencyLogin(sshRunner *crcssh.Runner) error { charset := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" b := make([]byte, 8) for i := range b { - b[i] = charset[rand.Intn(len(charset))] //nolint + b[i] = charset[rand.Intn(len(charset))] //nolint:gosec } if err := os.WriteFile(constants.PasswdFilePath, b, 0600); err != nil { return err diff --git a/pkg/crc/machine/vfkit/constants.go b/pkg/crc/machine/vfkit/constants.go index d067a42c2a..d6d8e9e1bf 100644 --- a/pkg/crc/machine/vfkit/constants.go +++ b/pkg/crc/machine/vfkit/constants.go @@ -1,5 +1,4 @@ //go:build darwin || build -// +build darwin build package vfkit diff --git a/pkg/crc/manpages/manpages_unix.go b/pkg/crc/manpages/manpages_unix.go index 6110f91e3e..eea23b32cb 100644 --- a/pkg/crc/manpages/manpages_unix.go +++ b/pkg/crc/manpages/manpages_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package manpages diff --git a/pkg/crc/manpages/manpages_unix_test.go b/pkg/crc/manpages/manpages_unix_test.go index 7a82cba1fd..35ee421737 100644 --- a/pkg/crc/manpages/manpages_unix_test.go +++ b/pkg/crc/manpages/manpages_unix_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package manpages diff --git a/pkg/crc/preflight/labels.go b/pkg/crc/preflight/labels.go index 0db6483b0e..ed889903c7 100644 --- a/pkg/crc/preflight/labels.go +++ b/pkg/crc/preflight/labels.go @@ -14,7 +14,7 @@ const ( // Keep it last // will be used in OS-specific go files to extend LabelName - lastLabelName // nolint + lastLabelName //nolint:unused ) type LabelValue uint32 @@ -31,7 +31,7 @@ const ( // Keep it last // will be used in OS-specific go files to extend LabelValue - lastLabelValue // nolint + lastLabelValue //nolint:unused ) var ( diff --git a/pkg/crc/preflight/preflight_checks_network_linux.go b/pkg/crc/preflight/preflight_checks_network_linux.go index c0a9c484f4..132ac294b3 100644 --- a/pkg/crc/preflight/preflight_checks_network_linux.go +++ b/pkg/crc/preflight/preflight_checks_network_linux.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package preflight diff --git a/pkg/crc/preflight/preflight_checks_nonlinux.go b/pkg/crc/preflight/preflight_checks_nonlinux.go index 468efab534..a7cb26bdab 100644 --- a/pkg/crc/preflight/preflight_checks_nonlinux.go +++ b/pkg/crc/preflight/preflight_checks_nonlinux.go @@ -1,5 +1,4 @@ //go:build !linux -// +build !linux package preflight diff --git a/pkg/crc/preflight/preflight_checks_unix.go b/pkg/crc/preflight/preflight_checks_unix.go index 9498a9efc0..0c7a06643e 100644 --- a/pkg/crc/preflight/preflight_checks_unix.go +++ b/pkg/crc/preflight/preflight_checks_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package preflight diff --git a/pkg/crc/preflight/preflight_ubuntu_linux.go b/pkg/crc/preflight/preflight_ubuntu_linux.go index 78aa20e08a..7ecf6db37a 100644 --- a/pkg/crc/preflight/preflight_ubuntu_linux.go +++ b/pkg/crc/preflight/preflight_ubuntu_linux.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package preflight diff --git a/pkg/crc/preflight/preflight_ubuntu_linux_test.go b/pkg/crc/preflight/preflight_ubuntu_linux_test.go index 11bc88884f..5c1dd72d7c 100644 --- a/pkg/crc/preflight/preflight_ubuntu_linux_test.go +++ b/pkg/crc/preflight/preflight_ubuntu_linux_test.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package preflight diff --git a/pkg/crc/ssh/keys_unix.go b/pkg/crc/ssh/keys_unix.go index 49ddf8aef5..8c42828d6c 100644 --- a/pkg/crc/ssh/keys_unix.go +++ b/pkg/crc/ssh/keys_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package ssh diff --git a/pkg/os/linux/release_info.go b/pkg/os/linux/release_info.go index e085c1875b..c807da707e 100644 --- a/pkg/os/linux/release_info.go +++ b/pkg/os/linux/release_info.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package linux diff --git a/pkg/os/linux/release_info_test.go b/pkg/os/linux/release_info_test.go index 443e41c10c..9f4ed8e09a 100644 --- a/pkg/os/linux/release_info_test.go +++ b/pkg/os/linux/release_info_test.go @@ -1,5 +1,4 @@ //go:build linux -// +build linux package linux diff --git a/pkg/os/shell/shell_unix.go b/pkg/os/shell/shell_unix.go index 43df1f7b80..2e2bc20102 100644 --- a/pkg/os/shell/shell_unix.go +++ b/pkg/os/shell/shell_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package shell diff --git a/pkg/os/shell/shell_unix_test.go b/pkg/os/shell/shell_unix_test.go index a9c24cc086..ec90820cda 100644 --- a/pkg/os/shell/shell_unix_test.go +++ b/pkg/os/shell/shell_unix_test.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package shell diff --git a/pkg/os/util_unix.go b/pkg/os/util_unix.go index 0d1528166d..cc6c063cb5 100644 --- a/pkg/os/util_unix.go +++ b/pkg/os/util_unix.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package os diff --git a/pkg/os/windows/win32/domains_windows.go b/pkg/os/windows/win32/domains_windows.go index c2dad0592c..2c1a3f87a4 100644 --- a/pkg/os/windows/win32/domains_windows.go +++ b/pkg/os/windows/win32/domains_windows.go @@ -23,7 +23,7 @@ import ( "github.com/yusufpapurcu/wmi" ) -// nolint +//nolint:staticcheck type Win32_ComputerSystem struct { Partofdomain bool } diff --git a/test/extended/os/applescript/applescript.go b/test/extended/os/applescript/applescript.go index 375710efc2..7973e97ca9 100644 --- a/test/extended/os/applescript/applescript.go +++ b/test/extended/os/applescript/applescript.go @@ -1,5 +1,4 @@ //go:build !windows -// +build !windows package applescript