diff options
author | Unknwon <u@gogs.io> | 2018-06-09 17:32:58 +0800 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-06-09 17:32:58 +0800 |
commit | fbecc18e2e4d4eb863a990a57218305f190ae6db (patch) | |
tree | 11278a833eec45d8bf710f4e6e27481975b96eaa /models/migrations | |
parent | b538c5345e1271fcaf413b82ba1ece555dd635a5 (diff) |
*: use jsoniter to replace encoding/json
Diffstat (limited to 'models/migrations')
-rw-r--r-- | models/migrations/v13.go | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/models/migrations/v13.go b/models/migrations/v13.go index f81271f9..3f7e81df 100644 --- a/models/migrations/v13.go +++ b/models/migrations/v13.go @@ -5,12 +5,12 @@ package migrations import ( - "encoding/json" "fmt" "strings" "github.com/Unknwon/com" "github.com/go-xorm/xorm" + "github.com/json-iterator/go" ) func ldapUseSSLToSecurityProtocol(x *xorm.Engine) error { @@ -30,17 +30,17 @@ func ldapUseSSLToSecurityProtocol(x *xorm.Engine) error { for _, result := range results { cfg := map[string]interface{}{} - if err = json.Unmarshal(result["cfg"], &cfg); err != nil { - return fmt.Errorf("decode JSON config: %v", err) + if err = jsoniter.Unmarshal(result["cfg"], &cfg); err != nil { + return fmt.Errorf("unmarshal JSON config: %v", err) } if com.ToStr(cfg["UseSSL"]) == "true" { cfg["SecurityProtocol"] = 1 // LDAPS } delete(cfg, "UseSSL") - data, err := json.Marshal(&cfg) + data, err := jsoniter.Marshal(&cfg) if err != nil { - return fmt.Errorf("encode JSON config: %v", err) + return fmt.Errorf("marshal JSON config: %v", err) } if _, err = sess.Exec("UPDATE `login_source` SET `cfg`=? WHERE `id`=?", |