update golangci-lint action to v3, golangci-lint to v1.48.0 (#3499)

* run gofmt -s -w

* stop using the deprecated io/ioutil package

* update golangci-lint action to v3, golangci-lint to v1.48.0
This commit is contained in:
Marten Seemann
2022-08-10 18:50:48 +02:00
committed by GitHub
parent 7ebe1430ef
commit 498475fa60
20 changed files with 39 additions and 37 deletions

View File

@@ -8,7 +8,6 @@ import (
"crypto/x509"
"crypto/x509/pkix"
"encoding/hex"
"io/ioutil"
"math/big"
"os"
"path/filepath"
@@ -33,7 +32,7 @@ func WriteCorpusFile(path string, data []byte) error {
}
}
hash := sha1.Sum(data)
return ioutil.WriteFile(filepath.Join(path, hex.EncodeToString(hash[:])), data, 0o644)
return os.WriteFile(filepath.Join(path, hex.EncodeToString(hash[:])), data, 0o644)
}
// WriteCorpusFileWithPrefix writes data to a corpus file in directory path.

View File

@@ -2,7 +2,6 @@ package helper
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
@@ -15,7 +14,7 @@ var _ = Describe("exporting", func() {
BeforeEach(func() {
var err error
dir, err = ioutil.TempDir("", "fuzzing-helper")
dir, err = os.MkdirTemp("", "fuzzing-helper")
Expect(err).ToNot(HaveOccurred())
fmt.Fprintf(GinkgoWriter, "Created temporary directory %s", dir)
})
@@ -32,7 +31,7 @@ var _ = Describe("exporting", func() {
Expect(WriteCorpusFile(dir, []byte("lorem ipsum"))).To(Succeed())
path := filepath.Join(dir, expectedShaSum)
Expect(path).To(BeARegularFile())
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
Expect(err).ToNot(HaveOccurred())
Expect(string(b)).To(Equal(data))
})
@@ -45,7 +44,7 @@ var _ = Describe("exporting", func() {
Expect(WriteCorpusFileWithPrefix(dir, []byte("lorem ipsum"), prefixLen)).To(Succeed())
path := filepath.Join(dir, expectedShaSum)
Expect(path).To(BeARegularFile())
b, err := ioutil.ReadFile(path)
b, err := os.ReadFile(path)
Expect(err).ToNot(HaveOccurred())
Expect(b[:prefixLen]).To(Equal(make([]byte, prefixLen)))
Expect(string(b[prefixLen:])).To(Equal(data))