Skip to content

Commit

Permalink
Fix linting errors: (tinkerbell#136)
Browse files Browse the repository at this point in the history
## Description


The version of golangci-lint was causing issues. It was also a bit old. Updating resolves the issues.

## Why is this needed



Fixes: #

## How Has This Been Tested?





## How are existing users impacted? What migration steps/scripts do we need?





## Checklist:

I have:

- [ ] updated the documentation and/or roadmap (if required)
- [ ] added unit or e2e tests
- [ ] provided instructions on how to upgrade
  • Loading branch information
mergify[bot] authored Dec 27, 2022
2 parents e37a49f + 134bdb4 commit 5de8772
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ run-image: ## run PBnJ container image
# BEGIN: lint-install .
# http://github.com/tinkerbell/lint-install

GOLINT_VERSION ?= v1.42.0
GOLINT_VERSION ?= v1.50.1
HADOLINT_VERSION ?= v2.7.0
SHELLCHECK_VERSION ?= v0.7.2
LINT_OS := $(shell uname)
Expand Down
2 changes: 1 addition & 1 deletion grpc/oob/bmc/bmc.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (m Action) setupConnection(ctx context.Context, user, password, host string
for _, elem := range successfulConnections {
conn := connections[elem]
if r, ok := conn.(common.Connection); ok && elem == "bmclib" {
defer r.Close(ctx) // nolint:revive // defer in a loop is OK here, as loop length is limited
defer r.Close(ctx) //nolint:revive // defer in a loop is OK here, as loop length is limited
}

if r, ok := conn.(oob.BMC); ok {
Expand Down
3 changes: 1 addition & 2 deletions grpc/oob/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package oob
import (
"context"
"errors"
"fmt"
"testing"
"time"

Expand Down Expand Up @@ -35,7 +34,7 @@ func TestParseAuth(t *testing.T) {
if errMsg != nil {
diff := cmp.Diff(tc.want.Error(), errMsg.Error())
if diff != "" {
t.Log(fmt.Sprintf("%+v", errMsg))
t.Logf("%+v", errMsg)
t.Fatalf(diff)
}
}
Expand Down
3 changes: 1 addition & 2 deletions grpc/rpc/bmc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"io/ioutil"
"os"
"os/exec"
"testing"
Expand Down Expand Up @@ -51,7 +50,7 @@ func setup() {
}
_, err := exec.LookPath("ipmitool")
if err != nil {
err := ioutil.WriteFile(tempIPMITool, []byte{}, 0o777)
err := os.WriteFile(tempIPMITool, []byte{}, 0o777)
if err != nil {
fmt.Println("didnt find ipmitool in PATH and couldnt create one in /tmp")
os.Exit(3) //nolint:revive // deep-exit here is OK
Expand Down
2 changes: 1 addition & 1 deletion grpc/taskrunner/taskrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func (r *Runner) worker(_ context.Context, logger logr.Logger, description, task
select {
case msg := <-messagesChan:
currStatus, _ := repo.Get(taskID)
sessionRecord.Messages = append(currStatus.Messages, msg) // nolint:gocritic // apparently this is the right slice
sessionRecord.Messages = append(currStatus.Messages, msg) //nolint:gocritic // apparently this is the right slice
_ = repo.Update(taskID, sessionRecord)
case <-actionSyn:
actionACK <- true
Expand Down
4 changes: 2 additions & 2 deletions test/runner/common.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package runner

import (
"io/ioutil"
"os"

"gopkg.in/yaml.v2"
)
Expand Down Expand Up @@ -40,7 +40,7 @@ type Resource struct {

// Config for the resources file.
func (c *ConfigFile) Config(name string) error {
config, err := ioutil.ReadFile(name)
config, err := os.ReadFile(name)
if err != nil {
return err
}
Expand Down

0 comments on commit 5de8772

Please sign in to comment.