Skip to content
This repository was archived by the owner on Jan 16, 2021. It is now read-only.

Commit 104557b

Browse files
albertolealPavan Kumar
authored andcommitted
Use the first version found in the response.
In releases_cmd.go we can break early from the version check loop
1 parent 6f07a13 commit 104557b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

releases_cmd.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ func (r *releasesCmd) printFiles(version string,
4646
for _, release := range releases {
4747
if release.Version == version {
4848
files = release.UserFiles
49+
break
4950
}
5051
}
5152
if files == "" {

releases_cmd_test.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestReleasesCmdError(t *testing.T) {
5555
ensure.NotNil(t, c.run(h.env, &client{}))
5656
}
5757

58-
func TestReleasesCmdPrintVersin(t *testing.T) {
58+
func TestReleasesCmdPrintVersion(t *testing.T) {
5959
h, r := newReleasesCmdHarness(t)
6060
releases := []releasesResponse{
6161
{Version: "v1",
@@ -69,6 +69,12 @@ func TestReleasesCmdPrintVersin(t *testing.T) {
6969
"public": {"index.html": "2", "docs.html": "2"}
7070
}`,
7171
},
72+
{Version: "v2",
73+
UserFiles: `{
74+
"cloud": {"v2_main.js": "2", "v2_app.js": "2", "views/v2_docs.js": "2"},
75+
"public": {"v2_index.html": "2", "v2_docs.html": "2"}
76+
}`,
77+
},
7278
}
7379
err := r.printFiles("", releases, h.env)
7480
ensure.Err(t, err, regexp.MustCompile("Unable to fetch files for release version"))

0 commit comments

Comments
 (0)