Skip to content

Commit ac28333

Browse files
authored
chose: update go module dependencies (#829)
* chose: update go module dependencies * bump to go1.20 * bump golangci-lint seeing error ``` Installing golangci-lint golangci/golangci-lint info checking GitHub for tag 'v1.44.0' golangci/golangci-lint info found version: 1.44.0 for v1.44.0/linux/amd64 golangci/golangci-lint info installed /home/runner/go/bin/golangci-lint panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt goroutine 1 [running]: github.com/go-critic/go-critic/checkers.init.22() github.com/go-critic/[email protected]/checkers/embedded_rules.go:46 +0x4b4 ``` * fix some linting * some linter updates
1 parent 22f508a commit ac28333

File tree

9 files changed

+91
-671
lines changed

9 files changed

+91
-671
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,12 @@ jobs:
1313

1414
build:
1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
goVer: [1.17]
1916
steps:
2017

2118
- name: Set up Go ${{ matrix.goVer }}
2219
uses: actions/setup-go@v3
2320
with:
24-
go-version: ${{ matrix.goVer }}
21+
go-version: '1.20'
2522
id: go
2623

2724
- name: Check out code into the Go module directory

.golangci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ linters-settings:
2020
errcheck:
2121
check-type-assertions: false
2222
check-blank: false
23+
staticcheck:
24+
checks:
25+
- all
26+
- "-SA1019" # allow usage of global rand.Seed
27+
2328

2429
# options for analysis running
2530
run:
@@ -38,9 +43,7 @@ run:
3843
linters:
3944
disable-all: true
4045
enable:
41-
- deadcode
4246
- errcheck
43-
- gci
4447
- gocritic
4548
- gofmt
4649
- goimports
@@ -51,8 +54,7 @@ linters:
5154
- prealloc
5255
- revive
5356
- staticcheck
54-
- structcheck
5557
- stylecheck
5658
- unconvert
5759
- unparam
58-
- varcheck
60+
- unused

cmd/krew/cmd/info.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,12 +80,12 @@ func printPluginInfo(out io.Writer, indexName string, plugin index.Plugin) {
8080
// indent converts strings to an indented format ready for printing.
8181
// Example:
8282
//
83-
// \
84-
// | This plugin is great, use it with great care.
85-
// | Also, plugin will require the following programs to run:
86-
// | * jq
87-
// | * base64
88-
// /
83+
// \
84+
// | This plugin is great, use it with great care.
85+
// | Also, plugin will require the following programs to run:
86+
// | * jq
87+
// | * base64
88+
// /
8989
func indent(s string) string {
9090
out := "\\\n"
9191
s = strings.TrimRightFunc(s, unicode.IsSpace)

cmd/krew/cmd/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func init() {
111111
"{{.CommandPath}}", "kubectl {{.CommandPath}}").Replace(rootCmd.UsageTemplate()))
112112
}
113113

114-
func preRun(cmd *cobra.Command, _ []string) error {
114+
func preRun(_ *cobra.Command, _ []string) error {
115115
// check must be done before ensureDirs, to detect krew's self-installation
116116
if !internal.IsBinDirInPATH(paths) {
117117
internal.PrintWarning(os.Stderr, internal.SetupInstructions()+"\n\n")

go.mod

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,37 @@
11
module sigs.k8s.io/krew
22

3-
go 1.17
3+
go 1.20
44

55
require (
6-
github.com/fatih/color v1.12.0
7-
github.com/google/go-cmp v0.5.6
8-
github.com/mattn/go-isatty v0.0.13
6+
github.com/fatih/color v1.15.0
7+
github.com/google/go-cmp v0.5.9
8+
github.com/mattn/go-isatty v0.0.19
99
github.com/pkg/errors v0.9.1
1010
github.com/sahilm/fuzzy v0.1.0
11-
github.com/spf13/cobra v1.2.1
11+
github.com/spf13/cobra v1.7.0
1212
github.com/spf13/pflag v1.0.5
13-
k8s.io/apimachinery v0.21.2
13+
k8s.io/apimachinery v0.27.3
1414
k8s.io/client-go v11.0.0+incompatible
15-
k8s.io/klog/v2 v2.8.0
16-
sigs.k8s.io/yaml v1.2.0
15+
k8s.io/klog/v2 v2.100.1
16+
sigs.k8s.io/yaml v1.3.0
1717
)
1818

1919
require (
20-
github.com/go-logr/logr v0.4.0 // indirect
20+
github.com/go-logr/logr v1.2.4 // indirect
2121
github.com/gogo/protobuf v1.3.2 // indirect
22-
github.com/google/gofuzz v1.1.0 // indirect
23-
github.com/inconshreveable/mousetrap v1.0.0 // indirect
24-
github.com/json-iterator/go v1.1.11 // indirect
22+
github.com/google/gofuzz v1.2.0 // indirect
23+
github.com/inconshreveable/mousetrap v1.1.0 // indirect
24+
github.com/json-iterator/go v1.1.12 // indirect
2525
github.com/kylelemons/godebug v1.1.0 // indirect
26-
github.com/mattn/go-colorable v0.1.8 // indirect
26+
github.com/mattn/go-colorable v0.1.13 // indirect
2727
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
28-
github.com/modern-go/reflect2 v1.0.1 // indirect
29-
golang.org/x/net v0.7.0 // indirect
30-
golang.org/x/sys v0.5.0 // indirect
31-
golang.org/x/text v0.7.0 // indirect
28+
github.com/modern-go/reflect2 v1.0.2 // indirect
29+
golang.org/x/net v0.12.0 // indirect
30+
golang.org/x/sys v0.10.0 // indirect
31+
golang.org/x/text v0.11.0 // indirect
3232
gopkg.in/inf.v0 v0.9.1 // indirect
3333
gopkg.in/yaml.v2 v2.4.0 // indirect
34-
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect
34+
k8s.io/utils v0.0.0-20230711102312-30195339c3c7 // indirect
35+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
36+
sigs.k8s.io/structured-merge-diff/v4 v4.3.0 // indirect
3537
)

go.sum

Lines changed: 48 additions & 631 deletions
Large diffs are not rendered by default.

hack/run-lint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ gopath="$(go env GOPATH)"
2323
if ! [[ -x "$gopath/bin/golangci-lint" ]]; then
2424
echo >&2 'Installing golangci-lint'
2525
curl --silent --fail --location \
26-
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$gopath/bin" v1.44.0
26+
https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$gopath/bin" v1.53.3
2727
fi
2828

2929
# configured by .golangci.yml

integration_test/testutil_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func augmentPATH(t *testing.T, v string) string {
111111
}
112112

113113
// skipShort is a test helper for skipping tests in -test.short runs.
114-
func skipShort(t *testing.T) {
114+
func skipShort(t *testing.T) { //nolint:gocritic
115115
t.Helper()
116116
if testing.Short() {
117117
t.Skip("skipping integration test")

internal/download/downloader_test.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,11 @@ func Test_extractMaliciousArchive(t *testing.T) {
588588
// tarGZArchiveForTesting creates an in-memory zip archive with entries from
589589
// the files map, where keys are the paths and values are the contents.
590590
// For example, to create an empty file `a` and another file `b/c`:
591-
// tarGZArchiveForTesting(map[string]string{
592-
// "a": "",
593-
// "b/c": "nested content",
594-
// })
591+
//
592+
// tarGZArchiveForTesting(map[string]string{
593+
// "a": "",
594+
// "b/c": "nested content",
595+
// })
595596
func tarGZArchiveForTesting(files map[string]string) (*bytes.Reader, error) {
596597
archiveBuffer := &bytes.Buffer{}
597598
gzArchiveBuffer := gzip.NewWriter(archiveBuffer)
@@ -624,7 +625,8 @@ func tarGZArchiveForTesting(files map[string]string) (*bytes.Reader, error) {
624625
// entries with empty content just create a directory. The zip spec requires that
625626
// parent directories are explicitly listed in the archive, so this must be done
626627
// for nested entries. For example, to create a file at `a/b/c`, you must pass:
627-
// map[string]string{"a": "", "a/b": "", "a/b/c": "nested content"}
628+
//
629+
// map[string]string{"a": "", "a/b": "", "a/b/c": "nested content"}
628630
func zipArchiveReaderForTesting(files map[string]string) (*bytes.Reader, error) {
629631
archiveBuffer := &bytes.Buffer{}
630632
zw := zip.NewWriter(archiveBuffer)

0 commit comments

Comments
 (0)