@@ -24,17 +24,20 @@ import (
2424 "github.com/arduino/arduino-cli/arduino/security"
2525 "github.com/arduino/arduino-cli/i18n"
2626 "github.com/arduino/go-paths-helper"
27+ easyjson "github.com/mailru/easyjson"
2728 "github.com/sirupsen/logrus"
2829 semver "go.bug.st/relaxed-semver"
2930)
3031
3132// Index represents Cores and Tools struct as seen from package_index.json file.
33+ //easyjson:json
3234type Index struct {
3335 Packages []* indexPackage `json:"packages"`
3436 IsTrusted bool
3537}
3638
3739// indexPackage represents a single entry from package_index.json file.
40+ //easyjson:json
3841type indexPackage struct {
3942 Name string `json:"name"`
4043 Maintainer string `json:"maintainer"`
@@ -47,6 +50,7 @@ type indexPackage struct {
4750}
4851
4952// indexPlatformRelease represents a single Core Platform from package_index.json file.
53+ //easyjson:json
5054type indexPlatformRelease struct {
5155 Name string `json:"name"`
5256 Architecture string `json:"architecture"`
@@ -65,32 +69,37 @@ type indexPlatformRelease struct {
6569}
6670
6771// indexToolDependency represents a single dependency of a core from a tool.
72+ //easyjson:json
6873type indexToolDependency struct {
6974 Packager string `json:"packager"`
7075 Name string `json:"name"`
7176 Version * semver.RelaxedVersion `json:"version"`
7277}
7378
7479// indexDiscoveryDependency represents a single dependency of a core from a pluggable discovery tool.
80+ //easyjson:json
7581type indexDiscoveryDependency struct {
7682 Packager string `json:"packager"`
7783 Name string `json:"name"`
7884}
7985
8086// indexMonitorDependency represents a single dependency of a core from a pluggable monitor tool.
87+ //easyjson:json
8188type indexMonitorDependency struct {
8289 Packager string `json:"packager"`
8390 Name string `json:"name"`
8491}
8592
8693// indexToolRelease represents a single Tool from package_index.json file.
94+ //easyjson:json
8795type indexToolRelease struct {
8896 Name string `json:"name"`
8997 Version * semver.RelaxedVersion `json:"version"`
9098 Systems []indexToolReleaseFlavour `json:"systems"`
9199}
92100
93101// indexToolReleaseFlavour represents a single tool flavor in the package_index.json file.
102+ //easyjson:json
94103type indexToolReleaseFlavour struct {
95104 OS string `json:"host"`
96105 URL string `json:"url"`
@@ -100,17 +109,20 @@ type indexToolReleaseFlavour struct {
100109}
101110
102111// indexBoard represents a single Board as written in package_index.json file.
112+ //easyjson:json
103113type indexBoard struct {
104114 Name string `json:"name"`
105115 ID []indexBoardID `json:"id,omitempty"`
106116}
107117
108118// indexBoardID represents the ID of a single board. i.e. uno, yun, diecimila, micro and the likes
119+ //easyjson:json
109120type indexBoardID struct {
110121 USB string `json:"usb"`
111122}
112123
113124// indexHelp represents the help URL
125+ //easyjson:json
114126type indexHelp struct {
115127 Online string `json:"online,omitempty"`
116128}
@@ -352,7 +364,7 @@ func LoadIndex(jsonIndexFile *paths.Path) (*Index, error) {
352364 return nil , err
353365 }
354366 var index Index
355- err = json .Unmarshal (buff , & index )
367+ err = easyjson .Unmarshal (buff , & index )
356368 if err != nil {
357369 return nil , err
358370 }
@@ -381,7 +393,7 @@ func LoadIndexNoSign(jsonIndexFile *paths.Path) (*Index, error) {
381393 return nil , err
382394 }
383395 var index Index
384- err = json .Unmarshal (buff , & index )
396+ err = easyjson .Unmarshal (buff , & index )
385397 if err != nil {
386398 return nil , err
387399 }
0 commit comments