Skip to content

Commit f59e20e

Browse files
committed
Fixed output (that made the tests fail)
1 parent d3f36e4 commit f59e20e

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

commands/lib/download.go

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,22 @@ func LibraryDownload(ctx context.Context, req *rpc.LibraryDownloadReq, downloadC
3737
logrus.Info("Preparing download")
3838

3939
var version *semver.Version
40-
if v, err := semver.Parse(req.GetVersion()); err == nil {
41-
version = v
42-
} else {
43-
return nil, fmt.Errorf("invalid version: %s", err)
40+
if req.GetVersion() != "" {
41+
if v, err := semver.Parse(req.GetVersion()); err == nil {
42+
version = v
43+
} else {
44+
return nil, fmt.Errorf("invalid version: %s", err)
45+
}
4446
}
47+
4548
ref := &librariesindex.Reference{Name: req.GetName(), Version: version}
46-
if lib := lm.Index.FindRelease(ref); lib == nil {
47-
return nil, fmt.Errorf("library not found: %s", ref.String())
48-
} else {
49-
err := downloadLibrary(lm, lib, downloadCB)
50-
if err != nil {
51-
return nil, err
52-
}
49+
lib := lm.Index.FindRelease(ref)
50+
if lib == nil {
51+
return nil, fmt.Errorf("library %s not found", ref.String())
52+
}
53+
54+
if err := downloadLibrary(lm, lib, downloadCB); err != nil {
55+
return nil, err
5356
}
5457

5558
return &rpc.LibraryDownloadResp{}, nil

0 commit comments

Comments
 (0)