From e2fe760d9d8e2242f72575286981b68ccb048102 Mon Sep 17 00:00:00 2001 From: Mauro Morales Date: Fri, 28 Mar 2025 15:50:29 +0100 Subject: [PATCH] golint Signed-off-by: Mauro Morales --- .golangci.yml | 46 +++++++++++++++++++++++++--------------- internal/cli/register.go | 4 ++-- internal/role/p2p/k0s.go | 2 +- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 6dc3102..701b6e4 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,23 +1,35 @@ +version: "2" run: - timeout: 5m tests: false -issues: - exclude-dirs: - - tests/ linters: enable: - - revive # replacement for golint - - dupl # check duplicated code - - goconst # check strings that can turn into constants - - gofmt # check fmt - - goheader # Check license headers, only checks files in current year - - goimports # check imports - - gocyclo # check complexity - - govet - - gosimple - - ineffassign - - unused - - staticcheck - - typecheck + - dupl + - goconst + - gocyclo - godot + - goheader - misspell + - revive + exclusions: + generated: lax + presets: + - comments + - common-false-positives + - legacy + - std-error-handling + paths: + - tests/ + - third_party$ + - builtin$ + - examples$ +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: lax + paths: + - tests/ + - third_party$ + - builtin$ + - examples$ diff --git a/internal/cli/register.go b/internal/cli/register.go index ada6ba9..f08b3b8 100644 --- a/internal/cli/register.go +++ b/internal/cli/register.go @@ -103,12 +103,12 @@ func register(loglevel, arg, configFile, device string, reboot, poweroff bool) e if arg != "" { isDir, err := isDirectory(arg) if err == nil && isDir { - return fmt.Errorf("Cannot register with a directory, please pass a file.") //nolint:revive // This is a message printed to the user. + return fmt.Errorf("cannot register with a directory, please pass a file") } else if err != nil { return err } if !isReadable(arg) { - return fmt.Errorf("Cannot register with a file that is not readable.") //nolint:revive // This is a message printed to the user. + return fmt.Errorf("cannot register with a file that is not readable") } } // dmesg -D to suppress tty ev diff --git a/internal/role/p2p/k0s.go b/internal/role/p2p/k0s.go index 2445b00..9d1c9af 100644 --- a/internal/role/p2p/k0s.go +++ b/internal/role/p2p/k0s.go @@ -122,7 +122,7 @@ func (k *K0sNode) GenArgs() ([]string, error) { pconfig := k.ProviderConfig() if !pconfig.P2P.UseVPNWithKubernetes() { - return args, errors.New("Having a VPN but not using it for Kubernetes is not yet supported with k0s") + return args, errors.New("having a VPN but not using it for Kubernetes is not yet supported with k0s") } if pconfig.KubeVIP.IsEnabled() {