mirror of
https://github.com/Hopiu/micro.git
synced 2026-03-21 00:10:29 +00:00
change pluginmanager json to json5
This commit is contained in:
parent
55c790f069
commit
23ef69b935
2 changed files with 8 additions and 7 deletions
|
|
@ -3,7 +3,6 @@ package main
|
|||
import (
|
||||
"archive/zip"
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
|
|
@ -16,6 +15,7 @@ import (
|
|||
"sync"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/yosuke-furukawa/json5/encoding/json5"
|
||||
"github.com/yuin/gopher-lua"
|
||||
)
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ func (pc PluginChannel) Fetch() PluginPackages {
|
|||
return PluginPackages{}
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
decoder := json5.NewDecoder(resp.Body)
|
||||
|
||||
var repositories []PluginRepository
|
||||
if err := decoder.Decode(&repositories); err != nil {
|
||||
|
|
@ -134,7 +134,7 @@ func (pr PluginRepository) Fetch() PluginPackages {
|
|||
return PluginPackages{}
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
decoder := json.NewDecoder(resp.Body)
|
||||
decoder := json5.NewDecoder(resp.Body)
|
||||
|
||||
var plugins PluginPackages
|
||||
if err := decoder.Decode(&plugins); err != nil {
|
||||
|
|
@ -152,7 +152,7 @@ func (pv *PluginVersion) UnmarshalJSON(data []byte) error {
|
|||
Require map[string]string
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(data, &values); err != nil {
|
||||
if err := json5.Unmarshal(data, &values); err != nil {
|
||||
return err
|
||||
}
|
||||
pv.Version = values.Version
|
||||
|
|
@ -176,7 +176,7 @@ func (pp *PluginPackage) UnmarshalJSON(data []byte) error {
|
|||
Tags []string
|
||||
Versions PluginVersions
|
||||
}
|
||||
if err := json.Unmarshal(data, &values); err != nil {
|
||||
if err := json5.Unmarshal(data, &values); err != nil {
|
||||
return err
|
||||
}
|
||||
pp.Name = values.Name
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"github.com/blang/semver"
|
||||
"testing"
|
||||
|
||||
"github.com/yosuke-furukawa/json5/encoding/json5"
|
||||
)
|
||||
|
||||
func TestDependencyResolving(t *testing.T) {
|
||||
|
|
@ -20,7 +21,7 @@ func TestDependencyResolving(t *testing.T) {
|
|||
}]
|
||||
`
|
||||
var all PluginPackages
|
||||
err := json.Unmarshal([]byte(js), &all)
|
||||
err := json5.Unmarshal([]byte(js), &all)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue