Prechádzať zdrojové kódy

eleminating panic with more detailed log.Fatalf

Klaas, Wilfried 5 rokov pred
rodič
commit
18a5e346c2
2 zmenil súbory, kde vykonal 18 pridanie a 1 odobranie
  1. 17 0
      .vscode/launch.json
  2. 1 1
      GoHash.go

+ 17 - 0
.vscode/launch.json

@@ -0,0 +1,17 @@
+{
+    // Use IntelliSense to learn about possible attributes.
+    // Hover to view descriptions of existing attributes.
+    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
+    "version": "0.2.0",
+    "configurations": [
+        {
+            "name": "Launch",
+            "type": "go",
+            "request": "launch",
+            "mode": "auto",
+            "program": "${fileDirname}",
+            "env": {},
+            "args": ["e:\\temp\\Backup"]
+        }
+    ]
+}

+ 1 - 1
GoHash.go

@@ -131,7 +131,7 @@ func loadHashfile(filename string) Fdhashes {
 	data := Fdhashes{}
 	err = json.Unmarshal([]byte(file), &data)
 	if err != nil {
-		panic(err)
+		log.Fatalf("can't read file %s", filename)
 	}
 	return data
 }