mirror of
https://github.com/celogeek/piwigo-cli.git
synced 2025-05-25 02:02:37 +02:00
stream to stdout
This commit is contained in:
parent
234a63f208
commit
8697fa0956
@ -1,14 +1,20 @@
|
||||
/*
|
||||
Debug tools
|
||||
|
||||
debug.Dump(myStruct)
|
||||
*/
|
||||
package debug
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
|
||||
func Dump(v interface{}) (err error) {
|
||||
b, err := json.MarshalIndent(v, "", " ")
|
||||
if err == nil {
|
||||
fmt.Println(string(b))
|
||||
}
|
||||
return
|
||||
/*
|
||||
Dump an interface to the stdout
|
||||
*/
|
||||
func Dump(v interface{}) error {
|
||||
d := json.NewEncoder(os.Stdout)
|
||||
d.SetIndent("", " ")
|
||||
return d.Encode(v)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user