Skip to content

Commit

Permalink
server: include case with no fp provided
Browse files Browse the repository at this point in the history
  • Loading branch information
githubsands committed Jun 4, 2019
1 parent 4793d41 commit 78f9097
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion server/viper.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ func ConfigureFlagSet(applicationName string, f *pflag.FlagSet) {
//
// the CPU profile is created on the server's start
func CreateCPUProfileFile(v *viper.Viper, fp *pflag.FlagSet, l log.Logger) {
if fp == nil {
return
}

flag := fp.Lookup("cpuprofile")
if flag == nil {
return
Expand All @@ -110,6 +114,10 @@ func CreateCPUProfileFile(v *viper.Viper, fp *pflag.FlagSet, l log.Logger) {
// the memory profile is created on the server's exit.
// this function should be used within the application.
func CreateMemoryProfileFile(v *viper.Viper, fp *pflag.FlagSet, l log.Logger) {
if fp == nil {
return
}

flag := fp.Lookup("memprofile")
if flag == nil {
return
Expand Down Expand Up @@ -280,6 +288,7 @@ func Initialize(applicationName string, arguments []string, f *pflag.FlagSet, v
return
}

// CreateCPUProfileFile(v, f, logger)
CreateCPUProfileFile(v, f, logger)

return
}

0 comments on commit 78f9097

Please sign in to comment.