Skip to content

Commit 57ba470

Browse files
authored
Merge pull request #608 from rquitales/update-golangci-lint
chore: Bump golangci-lint version
2 parents c10935a + 49981f7 commit 57ba470

File tree

34 files changed

+191
-191
lines changed

34 files changed

+191
-191
lines changed

.golangci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ linters:
1010
disable-all: true
1111
enable:
1212
- bodyclose
13-
- deadcode
1413
- depguard
1514
- dogsled
1615
- dupl
@@ -31,14 +30,12 @@ linters:
3130
- misspell
3231
- nakedret
3332
- staticcheck
34-
- structcheck
3533
- stylecheck
3634
- revive
3735
- typecheck
3836
- unconvert
3937
- unparam
4038
- unused
41-
- varcheck
4239
- whitespace
4340

4441

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ all: generate license fix vet fmt test lint tidy
1616
go install github.com/google/[email protected]
1717

1818
"$(MYGOBIN)/golangci-lint":
19-
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.44.2
19+
go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.50.0
2020

2121
"$(MYGOBIN)/deepcopy-gen":
2222
go install k8s.io/code-generator/cmd/[email protected]

cmd/diff/cmddiff.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
package diff
55

66
import (
7-
"io/ioutil"
87
"os"
98

109
"github.com/spf13/cobra"
@@ -104,7 +103,7 @@ func Initialize(o *diff.DiffOptions, f util.Factory, args []string) (func(), err
104103
func createTempDir() (string, error) {
105104
// Create a temporary file with the passed prefix in
106105
// the default temporary directory.
107-
tmpDir, err := ioutil.TempDir("", tmpDirPrefix)
106+
tmpDir, err := os.MkdirTemp("", tmpDirPrefix)
108107
if err != nil {
109108
return "", err
110109
}

pkg/apply/common_test.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"bytes"
88
"context"
99
"fmt"
10-
"io/ioutil"
10+
"io"
1111
"net/http"
1212
"regexp"
1313
"testing"
@@ -240,20 +240,20 @@ func (g *genericHandler) handle(t *testing.T, req *http.Request) (*http.Response
240240

241241
if req.URL.Path == singlePath && req.Method == http.MethodGet {
242242
if r.exists {
243-
bodyRC := ioutil.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
243+
bodyRC := io.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
244244
return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: bodyRC}, true, nil
245245
}
246246
return &http.Response{StatusCode: http.StatusNotFound, Header: cmdtesting.DefaultHeader(), Body: cmdtesting.StringBody("")}, true, nil
247247
}
248248

249249
if req.URL.Path == singlePath && req.Method == http.MethodPatch {
250-
bodyRC := ioutil.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
250+
bodyRC := io.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
251251
return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: bodyRC}, true, nil
252252
}
253253

254254
if req.URL.Path == singlePath && req.Method == http.MethodDelete {
255255
if r.exists {
256-
bodyRC := ioutil.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
256+
bodyRC := io.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
257257
return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: bodyRC}, true, nil
258258
}
259259

@@ -271,12 +271,12 @@ func (g *genericHandler) handle(t *testing.T, req *http.Request) (*http.Response
271271
Kind: r.resource.GetKind(),
272272
},
273273
}
274-
bodyRC := ioutil.NopCloser(bytes.NewReader(toJSONBytes(t, result)))
274+
bodyRC := io.NopCloser(bytes.NewReader(toJSONBytes(t, result)))
275275
return &http.Response{StatusCode: status, Header: cmdtesting.DefaultHeader(), Body: bodyRC}, true, nil
276276
}
277277

278278
if req.URL.Path == allPath && req.Method == http.MethodPost {
279-
bodyRC := ioutil.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
279+
bodyRC := io.NopCloser(bytes.NewReader(toJSONBytes(t, r.resource)))
280280
return &http.Response{StatusCode: http.StatusCreated, Header: cmdtesting.DefaultHeader(), Body: bodyRC}, true, nil
281281
}
282282
}
@@ -341,7 +341,7 @@ func (n *nsHandler) handle(t *testing.T, req *http.Request) (*http.Response, boo
341341
Name: nsName,
342342
},
343343
}
344-
bodyRC := ioutil.NopCloser(bytes.NewReader(toJSONBytes(t, &ns)))
344+
bodyRC := io.NopCloser(bytes.NewReader(toJSONBytes(t, &ns)))
345345
return &http.Response{StatusCode: http.StatusOK, Header: cmdtesting.DefaultHeader(), Body: bodyRC}, true, nil
346346
}
347347
return nil, false, nil

pkg/apply/event/event.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
)
1414

1515
// Type determines the type of events that are available.
16+
//
1617
//go:generate stringer -type=Type
1718
type Type int
1819

pkg/apply/prune/event-factory.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ func CreateEventFactory(isDelete bool, groupName string) EventFactory {
3333

3434
// PruneEventFactory implements EventFactory interface as a concrete
3535
// representation of for prune events.
36+
//
3637
//nolint:revive // stuttering ok because Prune is a type of PruneEvent
3738
type PruneEventFactory struct {
3839
groupName string

pkg/apply/prune/prune.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,12 @@ type Options struct {
8080
// automatically prune/delete).
8181
//
8282
// Parameters:
83-
// objs - objects to prune (delete)
84-
// pruneFilters - list of filters for deletion permission
85-
// taskContext - task for apply/prune
86-
// taskName - name of the parent task group, for events
87-
// opts - options for dry-run
83+
//
84+
// objs - objects to prune (delete)
85+
// pruneFilters - list of filters for deletion permission
86+
// taskContext - task for apply/prune
87+
// taskName - name of the parent task group, for events
88+
// opts - options for dry-run
8889
func (p *Pruner) Prune(
8990
objs object.UnstructuredSet,
9091
pruneFilters []filter.ValidationFilter,

pkg/apply/task/apply_task.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"context"
88
"errors"
99
"fmt"
10-
"io/ioutil"
10+
"io"
1111
"strings"
1212

1313
"k8s.io/apimachinery/pkg/api/meta"
@@ -192,8 +192,8 @@ func newApplyOptions(taskName string, eventChannel chan<- event.Event, serverSid
192192
OpenAPIPatch: true, // Normally set in apply.NewApplyOptions
193193
Recorder: genericclioptions.NoopRecorder{},
194194
IOStreams: genericclioptions.IOStreams{
195-
Out: ioutil.Discard,
196-
ErrOut: ioutil.Discard, // TODO: Warning for no lastConfigurationAnnotation
195+
Out: io.Discard,
196+
ErrOut: io.Discard, // TODO: Warning for no lastConfigurationAnnotation
197197
// is printed directly to stderr in ApplyOptions. We
198198
// should turn that into a warning on the event channel.
199199
},

pkg/apply/taskrunner/runner.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ type Options struct {
4242
//
4343
// The tasks run in a loop where a single goroutine will process events from
4444
// three different channels.
45-
// - taskQueue is read to allow updating the task queue at runtime.
46-
// - statusChannel is read to allow updates to the resource cache and triggering
47-
// validation of wait conditions.
48-
// - eventChannel is written to with events based on status updates, if
49-
// emitStatusEvents is true.
45+
// - taskQueue is read to allow updating the task queue at runtime.
46+
// - statusChannel is read to allow updates to the resource cache and triggering
47+
// validation of wait conditions.
48+
// - eventChannel is written to with events based on status updates, if
49+
// emitStatusEvents is true.
5050
func (tsr *TaskStatusRunner) Run(
5151
ctx context.Context,
5252
taskContext *TaskContext,

pkg/common/common.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const (
9090
)
9191

9292
// ClientDryRun returns true if input drs is DryRunClient
93+
//
9394
//nolint:stylecheck // Prevent lint errors on receiver names caused by string generation above
9495
func (drs DryRunStrategy) ClientDryRun() bool {
9596
return drs == DryRunClient

0 commit comments

Comments
 (0)