From 64107887054f3161fb30bfe67d25a39e5deb3d40 Mon Sep 17 00:00:00 2001 From: Martin Lindhe Date: Mon, 8 Jan 2018 01:23:25 +0100 Subject: [PATCH] show '-' as filename for piped input --- main.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 4a84706..386dba9 100644 --- a/main.go +++ b/main.go @@ -27,15 +27,20 @@ func main() { os.Exit(1) } + filename := "-" + if *inFile != "" { + filename = *inFile + } + var f interface{} _, err = toml.Decode(string(data), &f) if err != nil { - fmt.Println("ERROR:", *inFile, err) + fmt.Println("ERROR:", filename, err) os.Exit(1) } if !*quiet { - fmt.Println("OK:", *inFile) + fmt.Println("OK:", filename) } }