1
0
mirror of https://github.com/beego/bee.git synced 2024-11-16 20:30:54 +00:00

[g_docs] Replace 'gopkg.in/yaml.v2' with 'github.com/ghodss/yaml'

Signed-off-by: weiyang <weiyang.ones@gmail.com>
This commit is contained in:
weiyang 2017-08-21 18:31:24 +08:00
parent 27ea6dfce9
commit 1357ee4cf8

View File

@ -29,7 +29,7 @@ import (
"strings"
"unicode"
"gopkg.in/yaml.v2"
"github.com/ghodss/yaml"
"github.com/astaxie/beego/swagger"
"github.com/astaxie/beego/utils"
@ -285,9 +285,14 @@ func GenerateDocs(curpath string) {
defer fdyml.Close()
defer fd.Close()
dt, err := json.MarshalIndent(rootapi, "", " ")
dtyml, erryml := yaml.Marshal(rootapi)
if err != nil || erryml != nil {
panic(err)
if err != nil {
msg := fmt.Sprintf("failed to marshal api doc: %s", err)
panic(msg)
}
dtyml, erryml := yaml.JSONToYAML(dt)
if erryml != nil {
msg := fmt.Sprintf("failed to convert json bytes to yaml bytes: %s", erryml)
panic(msg)
}
_, err = fd.Write(dt)
_, erryml = fdyml.Write(dtyml)