fix(ci): sort lang json file

This commit is contained in:
Noah Hsu
2022-12-05 14:39:18 +08:00
parent dc8d5106f9
commit bc6baf1be0
3 changed files with 8 additions and 10 deletions

View File

@ -1,6 +1,7 @@
package utils
import (
stdjson "encoding/json"
"os"
json "github.com/json-iterator/go"
@ -10,8 +11,11 @@ import (
var Json = json.ConfigCompatibleWithStandardLibrary
// WriteJsonToFile write struct to json file
func WriteJsonToFile(dst string, data interface{}) bool {
func WriteJsonToFile(dst string, data interface{}, std ...bool) bool {
str, err := json.MarshalIndent(data, "", " ")
if len(std) > 0 && std[0] {
str, err = stdjson.MarshalIndent(data, "", " ")
}
if err != nil {
log.Errorf("failed convert Conf to []byte:%s", err.Error())
return false