fix type convert error (#395)

master v1.1.4
kingxt 4 years ago committed by GitHub
parent 4db20677f7
commit 43e712d86a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -161,10 +161,26 @@ func NewPlugin() (*Plugin, error) {
if err != nil {
return nil, err
}
err = json.Unmarshal(content, &plugin)
var info struct {
ApiFilePath string
Style string
Dir string
}
err = json.Unmarshal(content, &info)
if err != nil {
return nil, err
}
plugin.ApiFilePath = info.ApiFilePath
plugin.Style = info.Style
plugin.Dir = info.Dir
api, err := parser.Parse(info.ApiFilePath)
if err != nil {
return nil, err
}
plugin.Api = api
return &plugin, nil
}

Loading…
Cancel
Save