mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 23:46:35 +01:00
refactor: replace ioutil=>io; update linter (#1211)
This commit is contained in:
@@ -3,7 +3,7 @@ package file
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"regexp"
|
||||
"text/template"
|
||||
|
||||
@@ -84,7 +84,7 @@ func (c Classifier) Classify(resolver source.FileResolver, location source.Locat
|
||||
defer internal.CloseAndLogError(contentReader, location.VirtualPath)
|
||||
|
||||
// TODO: there is room for improvement here, as this may use an excessive amount of memory. Alternate approach is to leverage a RuneReader.
|
||||
contents, err := ioutil.ReadAll(contentReader)
|
||||
contents, err := io.ReadAll(contentReader)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"regexp"
|
||||
"sort"
|
||||
|
||||
@@ -111,7 +110,7 @@ func extractValue(resolver source.FileResolver, location source.Location, start,
|
||||
}
|
||||
defer internal.CloseAndLogError(readCloser, location.VirtualPath)
|
||||
|
||||
n, err := io.CopyN(ioutil.Discard, readCloser, start)
|
||||
n, err := io.CopyN(io.Discard, readCloser, start)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to read contents for location=%q : %w", location, err)
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"regexp"
|
||||
|
||||
"github.com/anchore/syft/internal"
|
||||
@@ -79,7 +78,7 @@ func readerAtPosition(resolver source.FileResolver, location source.Location, se
|
||||
return nil, fmt.Errorf("unable to fetch reader for location=%q : %w", location, err)
|
||||
}
|
||||
if seekPosition > 0 {
|
||||
n, err := io.CopyN(ioutil.Discard, readCloser, seekPosition)
|
||||
n, err := io.CopyN(io.Discard, readCloser, seekPosition)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("unable to read contents for location=%q while searching for secrets: %w", location, err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user