Skip to content

Commit

Permalink
Fix formatting issues with gofumpt (securego#685)
Browse files Browse the repository at this point in the history
Signed-off-by: Cosmin Cojocar <ccojocar@cloudbees.com>
  • Loading branch information
ccojocar authored Aug 18, 2021
1 parent ba23b5e commit f285d61
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/tlsconfig/tlsconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand Down
6 changes: 3 additions & 3 deletions rules/fileperms.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
Expand All @@ -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"},
Expand All @@ -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"},
Expand Down
2 changes: 1 addition & 1 deletion testutils/pkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit f285d61

Please sign in to comment.