Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update linter and fix staticcheck issues #1659

Merged
merged 1 commit into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
- name: golangci-lint run
uses: golangci/golangci-lint-action@v2
with:
version: v1.31
version: v1.45
skip-pkg-cache: true
skip-build-cache: true
args: --timeout=2m0s -v
Expand Down
5 changes: 3 additions & 2 deletions cmd/sonobuoy/app/imagepullpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ package app
import (
"fmt"
"sort"
"strings"

"golang.org/x/text/cases"
"golang.org/x/text/language"
v1 "k8s.io/api/core/v1"
)

Expand All @@ -37,7 +38,7 @@ func (i *ImagePullPolicy) Type() string { return "ImagePullPolicy" }

func (i *ImagePullPolicy) Set(str string) error {
// Allow lowercase pull policies in command line
upcase := strings.Title(str)
upcase := cases.Title(language.AmericanEnglish).String(str)
policy, ok := pullPolicyMap[upcase]
if !ok {
return fmt.Errorf("unknown pull policy %q", str)
Expand Down
5 changes: 3 additions & 2 deletions cmd/sonobuoy/app/rbac.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ package app
import (
"context"
"fmt"
"strings"

"github.com/pkg/errors"
"golang.org/x/text/cases"
"golang.org/x/text/language"
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
Expand Down Expand Up @@ -60,7 +61,7 @@ func (r *RBACMode) Type() string { return "RBACMode" }
// Set the RBACMode to the given string, or error if it's not a known RBAC mode.
func (r *RBACMode) Set(str string) error {
// Allow lowercase on the command line
upcase := strings.Title(str)
upcase := cases.Title(language.AmericanEnglish).String(str)
mode, ok := rbacModeMap[upcase]
if !ok {
return fmt.Errorf("unknown RBAC mode %s", str)
Expand Down
6 changes: 4 additions & 2 deletions cmd/sonobuoy/app/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ package app

import (
"fmt"
"strings"

"golang.org/x/text/cases"
"golang.org/x/text/language"
)

type WaitOutputMode string
Expand All @@ -28,7 +30,7 @@ func (w *WaitOutputMode) Type() string { return "string" }
// Set the WaitOutputMode to the given string, or error if it's not a known WaitOutputMode mode.
func (w *WaitOutputMode) Set(str string) error {
// Allow lowercase on the command line
upcase := strings.Title(str)
upcase := cases.Title(language.AmericanEnglish).String(str)
mode, ok := waitOutputModeMap[upcase]
if !ok {
return fmt.Errorf("unknown wait output mode %s", str)
Expand Down
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ require (
github.com/spf13/viper v1.4.0
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b
golang.org/x/text v0.3.4
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.0-20200605160147-a5ece683394c
k8s.io/api v0.21.3
Expand Down