Skip to content

Commit eac6e26

Browse files
committed
Fix linter failures
1 parent fe5f107 commit eac6e26

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

github/github.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020
"encoding/json"
2121
"fmt"
2222
"io"
23-
"io/ioutil"
2423
"log"
2524
"net/http"
2625
"net/url"
26+
"os"
2727

2828
"github.com/ossf/scorecard/v4/clients/githubrepo/roundtripper"
2929
sclog "github.com/ossf/scorecard/v4/log"
@@ -123,7 +123,7 @@ func (c *Client) ParseFromFile(filepath string) (RepoInfo, error) {
123123
var ret RepoInfo
124124

125125
log.Printf("getting repo info from file: %s", filepath)
126-
repoInfo, err := ioutil.ReadFile(filepath)
126+
repoInfo, err := os.ReadFile(filepath)
127127
if err != nil {
128128
return ret, fmt.Errorf("reading GitHub event path: %w", err)
129129
}

install/install.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ package install
1919
import (
2020
"context"
2121
"fmt"
22-
"io/ioutil"
2322
"log"
23+
"os"
2424

2525
"github.com/google/go-github/v42/github"
2626

@@ -42,8 +42,11 @@ var workflowFiles = []string{
4242
// organization.
4343
// TODO(install): Improve description.
4444
// TODO(install): Accept a context instead of setting one.
45-
//nolint:gocognit
4645
// TODO(lint): cognitive complexity 31 of func `Run` is high (> 30) (gocognit).
46+
//
47+
// TODO(lint): cognitive complexity 31 of func `Run` is high (> 30) (gocognit).
48+
//
49+
//nolint:gocognit
4750
func Run(o *options.Options) error {
4851
err := o.Validate()
4952
if err != nil {
@@ -69,7 +72,7 @@ func Run(o *options.Options) error {
6972
}
7073

7174
// Get yml file into byte array.
72-
workflowContent, err := ioutil.ReadFile(o.ConfigPath)
75+
workflowContent, err := os.ReadFile(o.ConfigPath)
7376
if err != nil {
7477
return fmt.Errorf("reading scorecard workflow file: %w", err)
7578
}

signing/signing.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"encoding/json"
2323
"fmt"
2424
"io"
25-
"io/ioutil"
2625
"net/http"
2726
"net/url"
2827
"os"
@@ -78,7 +77,7 @@ func GetJSONScorecardResults() ([]byte, error) {
7877
}
7978

8079
// Get json output data from file.
81-
jsonPayload, err := ioutil.ReadFile(os.Getenv(options.EnvInputResultsFile))
80+
jsonPayload, err := os.ReadFile(os.Getenv(options.EnvInputResultsFile))
8281
if err != nil {
8382
return nil, fmt.Errorf("reading scorecard json results from file: %w", err)
8483
}

signing/signing_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package signing
1818

1919
import (
20-
"io/ioutil"
20+
"os"
2121
"testing"
2222
)
2323

@@ -76,7 +76,7 @@ import (
7676
func Test_ProcessSignature(t *testing.T) {
7777
t.Parallel()
7878

79-
jsonPayload, err := ioutil.ReadFile("testdata/results.json")
79+
jsonPayload, err := os.ReadFile("testdata/results.json")
8080
repoName := "ossf-tests/scorecard-action"
8181
repoRef := "refs/heads/main"
8282
accessToken := ""

0 commit comments

Comments
 (0)