mirror of
https://github.com/beego/bee.git
synced 2024-06-16 08:43:33 +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:
parent
27ea6dfce9
commit
1357ee4cf8
|
@ -29,7 +29,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"gopkg.in/yaml.v2"
|
"github.com/ghodss/yaml"
|
||||||
|
|
||||||
"github.com/astaxie/beego/swagger"
|
"github.com/astaxie/beego/swagger"
|
||||||
"github.com/astaxie/beego/utils"
|
"github.com/astaxie/beego/utils"
|
||||||
|
@ -285,9 +285,14 @@ func GenerateDocs(curpath string) {
|
||||||
defer fdyml.Close()
|
defer fdyml.Close()
|
||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
dt, err := json.MarshalIndent(rootapi, "", " ")
|
dt, err := json.MarshalIndent(rootapi, "", " ")
|
||||||
dtyml, erryml := yaml.Marshal(rootapi)
|
if err != nil {
|
||||||
if err != nil || erryml != nil {
|
msg := fmt.Sprintf("failed to marshal api doc: %s", err)
|
||||||
panic(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)
|
_, err = fd.Write(dt)
|
||||||
_, erryml = fdyml.Write(dtyml)
|
_, erryml = fdyml.Write(dtyml)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user