mirror of
https://github.com/securego/gosec.git
synced 2024-11-05 19:45:51 +00:00
chore: fix lint warnings
Signed-off-by: Cosmin Cojocar <gcojocar@adobe.com>
This commit is contained in:
parent
d3933f9e14
commit
0ba05e160a
6 changed files with 10 additions and 14 deletions
|
@ -2,7 +2,6 @@ package gosec_test
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -30,7 +29,7 @@ var _ = Describe("Analyzer", func() {
|
|||
Context("when processing a package", func() {
|
||||
It("should not report an error if the package contains no Go files", func() {
|
||||
analyzer.LoadRules(rules.Generate(false).RulesInfo())
|
||||
dir, err := ioutil.TempDir("", "empty")
|
||||
dir, err := os.MkdirTemp("", "empty")
|
||||
defer os.RemoveAll(dir)
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
err = analyzer.Process(buildTags, dir)
|
||||
|
|
|
@ -17,7 +17,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
|
@ -354,7 +354,7 @@ func main() {
|
|||
}
|
||||
|
||||
if *flagQuiet {
|
||||
logger = log.New(ioutil.Discard, "", 0)
|
||||
logger = log.New(io.Discard, "", 0)
|
||||
} else {
|
||||
logger = log.New(logWriter, "[gosec] ", log.LstdFlags)
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ import (
|
|||
"flag"
|
||||
"fmt"
|
||||
"go/format"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/mozilla/tls-observatory/constants"
|
||||
|
@ -187,7 +187,7 @@ func main() {
|
|||
}
|
||||
|
||||
outputPath := filepath.Join(dir, *outputFile)
|
||||
if err := ioutil.WriteFile(outputPath, src, 0o644); err != nil {
|
||||
if err := os.WriteFile(outputPath, src, 0o644); err != nil {
|
||||
log.Fatalf("Writing output: %s", err)
|
||||
} //#nosec G306
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import (
|
|||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -64,7 +63,7 @@ func (c Config) convertGlobals() {
|
|||
// should be used with io.Reader to load configuration from
|
||||
// file or from string etc.
|
||||
func (c Config) ReadFrom(r io.Reader) (int64, error) {
|
||||
data, err := ioutil.ReadAll(r)
|
||||
data, err := io.ReadAll(r)
|
||||
if err != nil {
|
||||
return int64(len(data)), err
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package gosec_test
|
|||
|
||||
import (
|
||||
"go/ast"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
|
@ -18,9 +17,9 @@ var _ = Describe("Helpers", func() {
|
|||
var dir string
|
||||
JustBeforeEach(func() {
|
||||
var err error
|
||||
dir, err = ioutil.TempDir("", "gosec")
|
||||
dir, err = os.MkdirTemp("", "gosec")
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
_, err = ioutil.TempFile(dir, "test*.go")
|
||||
_, err = os.MkdirTemp(dir, "test*.go")
|
||||
Expect(err).ShouldNot(HaveOccurred())
|
||||
})
|
||||
AfterEach(func() {
|
||||
|
|
|
@ -3,7 +3,6 @@ package testutils
|
|||
import (
|
||||
"fmt"
|
||||
"go/build"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -30,7 +29,7 @@ type TestPackage struct {
|
|||
// NewTestPackage will create a new and empty package. Must call Close() to cleanup
|
||||
// auxiliary files
|
||||
func NewTestPackage() *TestPackage {
|
||||
workingDir, err := ioutil.TempDir("", "gosecs_test")
|
||||
workingDir, err := os.MkdirTemp("", "gosecs_test")
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
@ -53,7 +52,7 @@ func (p *TestPackage) write() error {
|
|||
return nil
|
||||
}
|
||||
for filename, content := range p.Files {
|
||||
if e := ioutil.WriteFile(filename, []byte(content), 0o644); e != nil {
|
||||
if e := os.WriteFile(filename, []byte(content), 0o644); e != nil {
|
||||
return e
|
||||
} //#nosec G306
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue