mirror of
https://github.com/luscis/openlan.git
synced 2025-10-12 20:10:08 +08:00
fix: output yaml not pretty
This commit is contained in:
@@ -133,6 +133,13 @@ func LoadWithoutAnn(file string) ([]byte, error) {
|
||||
return ScanAnn(fp)
|
||||
}
|
||||
|
||||
func Unmarshal(v interface{}, contents []byte) error {
|
||||
if err := json.Unmarshal(contents, v); err != nil {
|
||||
return NewErr("%s", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func UnmarshalLoad(v interface{}, file string) error {
|
||||
if err := FileExist(file); err != nil {
|
||||
return NewErr("%s %s", file, err)
|
||||
@@ -141,10 +148,7 @@ func UnmarshalLoad(v interface{}, file string) error {
|
||||
if err != nil {
|
||||
return NewErr("%s %s", file, err)
|
||||
}
|
||||
if err := json.Unmarshal(contents, v); err != nil {
|
||||
return NewErr("%s", err)
|
||||
}
|
||||
return nil
|
||||
return Unmarshal(v, contents)
|
||||
}
|
||||
|
||||
func FunName(i interface{}) string {
|
||||
|
Reference in New Issue
Block a user