mirror of
https://github.com/securego/gosec.git
synced 2024-12-24 11:35:52 +00:00
Fix formatting issues with gofumpt (#685)
Signed-off-by: Cosmin Cojocar <ccojocar@cloudbees.com>
This commit is contained in:
parent
ba23b5e49a
commit
f285d612b5
4 changed files with 7 additions and 7 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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"},
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue