mirror of https://github.com/status-im/consul.git
13 lines
234 B
Go
13 lines
234 B
Go
|
package utils
|
||
|
|
||
|
import "encoding/json"
|
||
|
|
||
|
// Dump pretty prints the provided arg as json.
|
||
|
func Dump(v any) string {
|
||
|
b, err := json.MarshalIndent(v, "", " ")
|
||
|
if err != nil {
|
||
|
return "<ERR: " + err.Error() + ">"
|
||
|
}
|
||
|
return string(b)
|
||
|
}
|