Skip to content

Commit

Permalink
Fix newline and unhandled error
Browse files Browse the repository at this point in the history
  • Loading branch information
jotaen committed Nov 23, 2022
1 parent e6bb80a commit 3cba725
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions klog/app/cli/version.go
Expand Up @@ -53,6 +53,7 @@ func (opt *Version) Run(ctx app.Context) app.Error {

origin, v := fetchVersionInfo(versionCheckers)
close(stopTicker)
ctx.Print("\n")
if v == nil {
return app.NewError(
"Failed to retrieve version information.",
Expand All @@ -61,7 +62,6 @@ func (opt *Version) Run(ctx app.Context) app.Error {
)
}

ctx.Print("\n")
ctx.Debug(func() {
ctx.Print("Fetched from: " + origin.url + "\n")
})
Expand Down Expand Up @@ -107,7 +107,10 @@ func progressTicker(onTick func(), stop chan bool) {
// one after the other. It returns the first response that succeeds.
func fetchVersionInfo(origins []versionChecker) (*versionChecker, versionInfo) {
for _, origin := range origins {
req, _ := http.NewRequest(http.MethodGet, origin.url, nil)
req, err := http.NewRequest(http.MethodGet, origin.url, nil)
if err != nil {
continue
}
res, err := (&http.Client{
Timeout: time.Second * 5,
}).Do(req)
Expand Down

0 comments on commit 3cba725

Please sign in to comment.