diff options
author | Christian Pointner <equinox@helsinki.at> | 2017-01-25 23:59:07 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2017-01-25 23:59:07 (GMT) |
commit | 056b224e3241c6cf889ba1c7b0eba85a8f33cc4a (patch) | |
tree | dc40054aa1285e86ea31432e9a81b9faa1aef122 /src/file-hasher/main.go | |
parent | 5624f3ac623ed2caa8c3c3933e66d63aafc09914 (diff) |
generate json with absolute paths on stdout
Diffstat (limited to 'src/file-hasher/main.go')
-rw-r--r-- | src/file-hasher/main.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/file-hasher/main.go b/src/file-hasher/main.go index c25f690..1bb0132 100644 --- a/src/file-hasher/main.go +++ b/src/file-hasher/main.go @@ -22,6 +22,7 @@ package main import ( + "encoding/json" "log" "os" "os/signal" @@ -68,13 +69,14 @@ func main() { stdlog.Println("******************************") } stdlog.Println("") - for hash, file := range allFiles { - stdlog.Printf("%s: %s", hash, file) - } - stdlog.Println("") stdlog.Println("***************************************************************") stdlog.Printf("*** hashed %d files in %v", len(allFiles), time.Since(starttime)) stdlog.Println("***************************************************************") + + enc := json.NewEncoder(os.Stdout) + if err := enc.Encode(allFiles); err != nil { + stdlog.Printf("Error encoding JSON: %v", err) + } }() <-C |