mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 00:05:15 +00:00
16 lines
232 B
Go
16 lines
232 B
Go
|
package util
|
||
|
|
||
|
import (
|
||
|
"encoding/json"
|
||
|
"io/ioutil"
|
||
|
)
|
||
|
|
||
|
func WriteJsonFile(p string, obj interface{}) error {
|
||
|
out, err := json.MarshalIndent(obj, "", " ")
|
||
|
if err != nil {
|
||
|
return err
|
||
|
}
|
||
|
|
||
|
return ioutil.WriteFile(p, out, 0644)
|
||
|
}
|