Skip to content

Commit

Permalink
Merge pull request #2 from k1LoW/fix-dir-permission
Browse files Browse the repository at this point in the history
Resolve permission error when creating a directory.
  • Loading branch information
k1LoW authored May 4, 2021
2 parents dbc7826 + 5ad37a9 commit 645f9f5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,16 +71,14 @@ var rootCmd = &cobra.Command{

// Generate badge
if c.BadgeConfigReady() || genbadge {
var (
out *os.File
err error
)
var out *os.File
cp := r.CoveragePercent()
if c.Coverage.Badge == "" {
out = os.Stdout
} else {
cmd.PrintErrln("Generate coverage report badge...")
if err := os.MkdirAll(filepath.Dir(c.Coverage.Badge), 0644); err != nil {
err := os.MkdirAll(filepath.Dir(c.Coverage.Badge), 0755) // #nosec
if err != nil {
return err
}
out, err = os.OpenFile(filepath.Clean(c.Coverage.Badge), os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) // #nosec
Expand Down

0 comments on commit 645f9f5

Please sign in to comment.