生成代码,逐步进行优化
This commit is contained in:
+4
-1
@@ -1,6 +1,7 @@
|
||||
package common
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"math"
|
||||
@@ -258,8 +259,10 @@ func ObjToStr(obj interface{}) string {
|
||||
str = strconv.FormatFloat(obj.(float64), 'f', -1, 64)
|
||||
default:
|
||||
strbte, err := json.Marshal(obj)
|
||||
var configByte bytes.Buffer
|
||||
err = json.Indent(&configByte, strbte, "", "\t")
|
||||
if err == nil {
|
||||
str = string(strbte)
|
||||
str = configByte.String()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user