feat: add type to fs read api

This commit is contained in:
Noah Hsu
2022-08-08 00:51:05 +08:00
parent ccce6a30bb
commit 61fa6f38a8
11 changed files with 81 additions and 18 deletions

View File

@ -1,15 +1,16 @@
package utils
import (
"io/ioutil"
json "github.com/json-iterator/go"
log "github.com/sirupsen/logrus"
"io/ioutil"
)
var Json = json.ConfigCompatibleWithStandardLibrary
// WriteToJson write struct to json file
func WriteToJson(src string, conf interface{}) bool {
// WriteJsonToFile write struct to json file
func WriteJsonToFile(src string, conf interface{}) bool {
data, err := Json.MarshalIndent(conf, "", " ")
if err != nil {
log.Errorf("failed convert Conf to []byte:%s", err.Error())