hide error messages in non-debug mode

This commit is contained in:
ed 2019-12-18 12:27:09 +01:00
parent 3c6920df6b
commit 4c43773989
1 changed files with 16 additions and 2 deletions

16
main.go
View File

@ -9,13 +9,20 @@ import (
"io"
"io/ioutil"
"os"
// "strings"
"syscall"
"golang.org/x/crypto/ssh/terminal"
)
var debug bool = false
func checkErr(err error) {
if err != nil {
if debug {
panic(err.Error())
} else {
os.Exit(1)
}
}
}
@ -126,7 +133,14 @@ func main() {
secretfn := fn + ".hdn"
data2file(secretfn,secret)
case "s":
fmt.Println("decrypt")
fmt.Print("password: ")
pw := readPass()
fmt.Print("\n")
key := keyMkr(pw)
secret := file2data(fn)
datafn := fn + "clear"
data := decrypt(secret, key)
data2file(datafn, data)
}
/*
var passwd string = "ThisAnnPassphrase"