Skip to content

Commit

Permalink
Merge pull request #306 from coinbase/madhur/fix-salus
Browse files Browse the repository at this point in the history
[chore] fix salus issue
  • Loading branch information
irisZhangCB committed Apr 27, 2022
2 parents 5d4a266 + 165ce8f commit 3671644
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cmd/root.go
Expand Up @@ -20,6 +20,7 @@ import (
"log"
"os"
"os/signal"
"path"
"runtime"
"runtime/pprof"
"syscall"
Expand Down Expand Up @@ -92,7 +93,7 @@ var (
// Bassed on https://golang.org/pkg/runtime/pprof/#hdr-Profiling_a_Go_program
func rootPreRun(*cobra.Command, []string) error {
if cpuProfile != "" {
f, err := os.Create(cpuProfile)
f, err := os.Create(path.Clean(cpuProfile))
if err != nil {
return fmt.Errorf("%w: unable to create CPU profile file", err)
}
Expand All @@ -113,7 +114,7 @@ func rootPreRun(*cobra.Command, []string) error {

if blockProfile != "" {
runtime.SetBlockProfileRate(1)
f, err := os.Create(blockProfile)
f, err := os.Create(path.Clean(blockProfile))
if err != nil {
return fmt.Errorf("%w: unable to create block profile file", err)
}
Expand Down Expand Up @@ -144,7 +145,7 @@ func rootPostRun() {
}

if memProfile != "" {
f, err := os.Create(memProfile)
f, err := os.Create(path.Clean(memProfile))
if err != nil {
log.Printf("error while creating mem-profile file: %v", err)
return
Expand Down

0 comments on commit 3671644

Please sign in to comment.