Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
arduino-cli
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Operations
Operations
Metrics
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
arduino-cli
Commits
5057a021
Unverified
Commit
5057a021
authored
Jul 18, 2019
by
Massimiliano Pippi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix JSON marshal for platforms
parent
dcc1d2f5
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
8 deletions
+30
-8
arduino/cores/cores.go
arduino/cores/cores.go
+30
-8
No files found.
arduino/cores/cores.go
View file @
5057a021
...
...
@@ -18,6 +18,7 @@
package
cores
import
(
"encoding/json"
"strings"
paths
"github.com/arduino/go-paths-helper"
...
...
@@ -41,14 +42,13 @@ type PlatformRelease struct {
Resource
*
resources
.
DownloadResource
Version
*
semver
.
Version
BoardsManifest
[]
*
BoardManifest
Dependencies
ToolDependencies
// The Dependency entries to load tools.
Platform
*
Platform
`json:"-"`
Properties
*
properties
.
Map
`json:"-"`
Boards
map
[
string
]
*
Board
`json:"-"`
Programmers
map
[
string
]
*
properties
.
Map
`json:"-"`
Menus
*
properties
.
Map
`json:"-"`
InstallDir
*
paths
.
Path
`json:"-"`
Dependencies
ToolDependencies
// The Dependency entries to load tools.
Platform
*
Platform
`json:"-"`
Properties
*
properties
.
Map
`json:"-"`
Boards
map
[
string
]
*
Board
`json:"-"`
Programmers
map
[
string
]
*
properties
.
Map
`json:"-"`
Menus
*
properties
.
Map
`json:"-"`
InstallDir
*
paths
.
Path
`json:"-"`
}
// BoardManifest contains information about a board. These metadata are usually
...
...
@@ -226,3 +226,25 @@ func (release *PlatformRelease) String() string {
}
return
release
.
Platform
.
String
()
+
"@"
+
version
}
// MarshalJSON provides a more user friendly serialization for
// PlatformRelease objects.
func
(
release
*
PlatformRelease
)
MarshalJSON
()
([]
byte
,
error
)
{
latestStr
:=
""
latest
:=
release
.
Platform
.
GetLatestRelease
()
if
latest
!=
nil
{
latestStr
=
latest
.
Version
.
String
()
}
return
json
.
Marshal
(
&
struct
{
ID
string
`json:"ID,omitempty"`
Installed
string
`json:"Installed,omitempty"`
Latest
string
`json:"Latest,omitempty"`
Name
string
`json:"Name,omitempty"`
}{
ID
:
release
.
Platform
.
String
(),
Installed
:
release
.
Version
.
String
(),
Latest
:
latestStr
,
Name
:
release
.
Platform
.
Name
,
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment