diff --git a/cmd/tlsconfig/tlsconfig.go b/cmd/tlsconfig/tlsconfig.go index ece83ec..a9098bb 100644 --- a/cmd/tlsconfig/tlsconfig.go +++ b/cmd/tlsconfig/tlsconfig.go @@ -187,7 +187,7 @@ func main() { } outputPath := filepath.Join(dir, *outputFile) - if err := ioutil.WriteFile(outputPath, src, 0644); err != nil { + if err := ioutil.WriteFile(outputPath, src, 0o644); err != nil { log.Fatalf("Writing output: %s", err) } // #nosec G306 } diff --git a/helpers_test.go b/helpers_test.go index ee3114c..a4d484b 100644 --- a/helpers_test.go +++ b/helpers_test.go @@ -39,7 +39,7 @@ var _ = Describe("Helpers", func() { }) It("should exclude folder", func() { nested := dir + "/vendor" - err := os.Mkdir(nested, 0755) + err := os.Mkdir(nested, 0o755) Expect(err).ShouldNot(HaveOccurred()) _, err = os.Create(nested + "/test.go") Expect(err).ShouldNot(HaveOccurred()) @@ -51,7 +51,7 @@ var _ = Describe("Helpers", func() { }) It("should exclude folder with subpath", func() { nested := dir + "/pkg/generated" - err := os.MkdirAll(nested, 0755) + err := os.MkdirAll(nested, 0o755) Expect(err).ShouldNot(HaveOccurred()) _, err = os.Create(nested + "/test.go") Expect(err).ShouldNot(HaveOccurred()) diff --git a/rules/fileperms.go b/rules/fileperms.go index e6a80a5..93265dd 100644 --- a/rules/fileperms.go +++ b/rules/fileperms.go @@ -64,7 +64,7 @@ func (r *filePermissions) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, err // NewWritePerms creates a rule to detect file Writes with bad permissions. func NewWritePerms(id string, conf gosec.Config) (gosec.Rule, []ast.Node) { - mode := getConfiguredMode(conf, "G306", 0600) + mode := getConfiguredMode(conf, "G306", 0o600) return &filePermissions{ mode: mode, pkgs: []string{"io/ioutil", "os"}, @@ -81,7 +81,7 @@ func NewWritePerms(id string, conf gosec.Config) (gosec.Rule, []ast.Node) { // NewFilePerms creates a rule to detect file creation with a more permissive than configured // permission mask. func NewFilePerms(id string, conf gosec.Config) (gosec.Rule, []ast.Node) { - mode := getConfiguredMode(conf, "G302", 0600) + mode := getConfiguredMode(conf, "G302", 0o600) return &filePermissions{ mode: mode, pkgs: []string{"os"}, @@ -98,7 +98,7 @@ func NewFilePerms(id string, conf gosec.Config) (gosec.Rule, []ast.Node) { // NewMkdirPerms creates a rule to detect directory creation with more permissive than // configured permission mask. func NewMkdirPerms(id string, conf gosec.Config) (gosec.Rule, []ast.Node) { - mode := getConfiguredMode(conf, "G301", 0750) + mode := getConfiguredMode(conf, "G301", 0o750) return &filePermissions{ mode: mode, pkgs: []string{"os"}, diff --git a/testutils/pkg.go b/testutils/pkg.go index eb9cd42..1364e1d 100644 --- a/testutils/pkg.go +++ b/testutils/pkg.go @@ -53,7 +53,7 @@ func (p *TestPackage) write() error { return nil } for filename, content := range p.Files { - if e := ioutil.WriteFile(filename, []byte(content), 0644); e != nil { + if e := ioutil.WriteFile(filename, []byte(content), 0o644); e != nil { return e } // #nosec G306 }