Prechádzať zdrojové kódy

Geen fatal als de output file voor profiling niet gemaakt kan worden.

Harry de Boer 10 rokov pred
rodič
commit
97ac9312ad
2 zmenil súbory, kde vykonal 6 pridanie a 4 odobranie
  1. 3 2
      battlecamp-go-boardgenerator/main.go
  2. 3 2
      main.go

+ 3 - 2
battlecamp-go-boardgenerator/main.go

@@ -63,8 +63,9 @@ func initCpuProfiler() {
 	if *cpuprofile != "" {
 		f, err := os.Create(*cpuprofile)
 		if err != nil {
-			log.Fatal(err)
+			log.Printf("ERROR: %v\n", err)
+		} else {
+			pprof.StartCPUProfile(f)
 		}
-		pprof.StartCPUProfile(f)
 	}
 }

+ 3 - 2
main.go

@@ -21,9 +21,10 @@ func main() {
 	if *flag.CpuProfile != "" {
 		f, err := os.Create(*flag.CpuProfile)
 		if err != nil {
-			log.Fatal(err)
+			log.Printf("ERROR: %v\n", err)
+		} else {
+			pprof.StartCPUProfile(f)
 		}
-		pprof.StartCPUProfile(f)
 	}
 
 	gameServer.Serve()