Skip to content

Commit

Permalink
Upgrade the golangci-lint dependency.
Browse files Browse the repository at this point in the history
* The older version of `golangci-lint` on version `v1.52.1` was
  consuming an inordinate amount of memory, and thus ended up getting
  killed by the OS mid run.
  See golangci/golangci-lint#3582.

* Upgrade to a newer version of `golangci-lint`, `v1.61.0`.

* Fix all lint errors reported with the newer version.
  • Loading branch information
renormalize committed Oct 3, 2024
1 parent 9040608 commit a4816ce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
5 changes: 1 addition & 4 deletions hack/tools.mk
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ GOLANGCI_LINT := $(TOOLS_BIN_DIR)/golangci-lint
GO_ADD_LICENSE := $(TOOLS_BIN_DIR)/addlicense

# default tool versions
GOLANGCI_LINT_VERSION ?= v1.51.2
GOLANGCI_LINT_VERSION ?= v1.61.0
GO_ADD_LICENSE_VERSION ?= latest

export TOOLS_BIN_DIR := $(TOOLS_BIN_DIR)
export PATH := $(abspath $(TOOLS_BIN_DIR)):$(PATH)
$(info "TOOLS_BIN_DIR from tools.mk", $(TOOLS_BIN_DIR))
$(info "TOOLS_DIR from tools.mk", $(TOOLS_DIR))
$(info "PATH from tools.mk", $(PATH))

#########################################
# Tools #
Expand Down
12 changes: 6 additions & 6 deletions internal/app/fakes.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,31 +14,31 @@ import (
type EtcdFakeKV struct{}

// Get gets a value for a given key.
func (c *EtcdFakeKV) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error) {
func (c *EtcdFakeKV) Get(_ context.Context, _ string, _ ...clientv3.OpOption) (*clientv3.GetResponse, error) {
return nil, nil
}

// Put puts a value for a given key.
func (c *EtcdFakeKV) Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error) {
func (c *EtcdFakeKV) Put(_ context.Context, _, _ string, _ ...clientv3.OpOption) (*clientv3.PutResponse, error) {
return nil, nil
}

// Delete deletes an entry with a given key.
func (c *EtcdFakeKV) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error) {
func (c *EtcdFakeKV) Delete(_ context.Context, _ string, _ ...clientv3.OpOption) (*clientv3.DeleteResponse, error) {
return nil, nil
}

// Compact compacts etcd KV history before the given rev.
func (c *EtcdFakeKV) Compact(ctx context.Context, rev int64, opts ...clientv3.CompactOption) (*clientv3.CompactResponse, error) {
func (c *EtcdFakeKV) Compact(_ context.Context, _ int64, _ ...clientv3.CompactOption) (*clientv3.CompactResponse, error) {
return nil, nil
}

// Txn creates a transaction.
func (c *EtcdFakeKV) Txn(ctx context.Context) clientv3.Txn {
func (c *EtcdFakeKV) Txn(_ context.Context) clientv3.Txn {
return nil
}

// Do applies a single Op on KV without a transaction.
func (c *EtcdFakeKV) Do(ctx context.Context, op clientv3.Op) (clientv3.OpResponse, error) {
func (c *EtcdFakeKV) Do(_ context.Context, _ clientv3.Op) (clientv3.OpResponse, error) {
return clientv3.OpResponse{}, nil
}
2 changes: 1 addition & 1 deletion internal/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func deleteTestDir(t *testing.T, testDir string) {

func getTestHttpClient(responseCode int, responseBody []byte) *http.Client {
return &http.Client{
Transport: TestRoundTripper(func(req *http.Request) *http.Response {
Transport: TestRoundTripper(func(_ *http.Request) *http.Response {
var contentLen int64
if responseBody != nil {
contentLen = int64(len(responseBody))
Expand Down
2 changes: 1 addition & 1 deletion internal/brclient/brclient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func TestNewDefaultClient(t *testing.T) {

func getTestHttpClient(responseCode int, responseBody []byte) *http.Client {
return &http.Client{
Transport: TestRoundTripper(func(req *http.Request) *http.Response {
Transport: TestRoundTripper(func(_ *http.Request) *http.Response {
var contentLen int64
if responseBody != nil {
contentLen = int64(len(responseBody))
Expand Down
2 changes: 1 addition & 1 deletion internal/util/retry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func TestErrorIfExceedsAttempts(t *testing.T) {
for _, entry := range table {
g := NewWithT(t)
logger := zaptest.NewLogger(t)
t.Run(entry.description, func(t *testing.T) {
t.Run(entry.description, func(_ *testing.T) {
defer clearRetryResults()
result := Retry(context.Background(), logger, operation, neverSucceeds, numAttempts, backOff, entry.canRetryFn)
g.Expect(result.Value).To(Equal(attemptFailed))
Expand Down

0 comments on commit a4816ce

Please sign in to comment.