From cb6afac5939426067a6c1157b4f4f6760fea2421 Mon Sep 17 00:00:00 2001 From: Erikas Date: Fri, 5 Jul 2024 00:17:48 +0300 Subject: [PATCH] return code --- server.go | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/server.go b/server.go index 0038d92..3f0b311 100644 --- a/server.go +++ b/server.go @@ -29,18 +29,16 @@ var ( func Start(c *Config) { // Setup data dir // - //// Commented out, otherwise In Docker it would throw 'panic: Failed to create data dir: mkdir "/data": no such file or directory' - // _, err := os.Stat(c.DataDir) - // if os.IsNotExist(err) { - // err := os.Mkdir(c.DataDir, 0755) - // if err != nil { - // panic("Failed to create data dir: " + err.Error()) - // } - // } else if err != nil { - // panic("Failed to check data dir: " + err.Error()) - // } + _, err := os.Stat(c.DataDir) + if os.IsNotExist(err) { + err := os.Mkdir(c.DataDir, 0755) + if err != nil { + panic("Failed to create data dir: " + err.Error()) + } + } else if err != nil { + panic("Failed to check data dir: " + err.Error()) + } - var err error benchmarksDir = filepath.Join(c.DataDir, "benchmarks") _, err = os.Stat(benchmarksDir) if os.IsNotExist(err) {