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