Skip to content

Commit df44d15

Browse files
committed
Fixing test: solving regression in lib search output (part 3)
1 parent fb93127 commit df44d15

File tree

4 files changed

+178
-181
lines changed

4 files changed

+178
-181
lines changed

commands/lib/list.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,16 @@ import (
2727
"github.com/arduino/arduino-cli/rpc"
2828
)
2929

30-
type InstalledLib struct {
31-
Library *libraries.Library `json:"library"`
32-
Available *librariesindex.Release `omitempy,json:"available"`
30+
type installedLib struct {
31+
Library *libraries.Library
32+
Available *librariesindex.Release
3333
}
3434

3535
func LibraryList(ctx context.Context, req *rpc.LibraryListReq) (*rpc.LibraryListResp, error) {
36-
3736
lm := commands.GetLibraryManager(req)
37+
3838
instaledLib := []*rpc.InstalledLibrary{}
39-
res := ListLibraries(lm, req.GetUpdatable(), req.GetAll())
39+
res := listLibraries(lm, req.GetUpdatable(), req.GetAll())
4040
if len(res) > 0 {
4141
for _, lib := range res {
4242
libtmp := GetOutputLibrary(lib.Library)
@@ -52,11 +52,10 @@ func LibraryList(ctx context.Context, req *rpc.LibraryListReq) (*rpc.LibraryList
5252
return &rpc.LibraryListResp{}, nil
5353
}
5454

55-
// ListLibraries returns the list of installed libraries. If updatable is true it
55+
// listLibraries returns the list of installed libraries. If updatable is true it
5656
// returns only the libraries that may be updated.
57-
func ListLibraries(lm *librariesmanager.LibrariesManager, updatable bool, all bool) []*InstalledLib {
58-
59-
res := []*InstalledLib{}
57+
func listLibraries(lm *librariesmanager.LibrariesManager, updatable bool, all bool) []*installedLib {
58+
res := []*installedLib{}
6059
for _, libAlternatives := range lm.Libraries {
6160
for _, lib := range libAlternatives.Alternatives {
6261
if !all {
@@ -71,7 +70,7 @@ func ListLibraries(lm *librariesmanager.LibrariesManager, updatable bool, all bo
7170
continue
7271
}
7372
}
74-
res = append(res, &InstalledLib{
73+
res = append(res, &installedLib{
7574
Library: lib,
7675
Available: available,
7776
})
@@ -117,7 +116,7 @@ func GetOutputLibrary(lib *libraries.Library) *rpc.Library {
117116
RealName: lib.RealName,
118117
DotALinkage: lib.DotALinkage,
119118
Precompiled: lib.Precompiled,
120-
LDflags: lib.LDflags,
119+
LdFlags: lib.LDflags,
121120
IsLegacy: lib.IsLegacy,
122121
Version: lib.Version.String(),
123122
License: lib.LDflags,

commands/lib/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func LibraryUpgradeAll(ctx context.Context, req *rpc.LibraryUpgradeAllReq, downl
2929
lm := commands.GetLibraryManager(req)
3030

3131
// Obtain the list of upgradable libraries
32-
list := ListLibraries(lm, true, true)
32+
list := listLibraries(lm, true, true)
3333

3434
for _, upgradeDesc := range list {
3535
if err := downloadLibrary(lm, upgradeDesc.Available, downloadCB, taskCB); err != nil {

0 commit comments

Comments
 (0)