Skip to content

Commit

Permalink
Fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
jbygdell committed Nov 12, 2024
1 parent 8fced1b commit 7ad6477
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ func Version(ver string) error {
client := &http.Client{Timeout: timeout}
resp, err := client.Do(req)
if err != nil {
fmt.Fprintf(os.Stderr, "failed to fetch releases, reson: %s\n", err.Error())
fmt.Fprintf(os.Stderr, "failed to fetch releases, reason: %s\n", err.Error())
fmt.Println("sda-cli version: ", ver)

return nil
}
if resp.StatusCode >= 400 {
fmt.Fprintf(os.Stderr, "failed to fetch releases, reson: %s\n", resp.Status)
fmt.Fprintf(os.Stderr, "failed to fetch releases, reason: %s\n", resp.Status)
fmt.Println("sda-cli version: ", ver)

return nil
Expand All @@ -93,22 +93,22 @@ func Version(ver string) error {

appVer, err := version.NewVersion(ver)
if err != nil {
fmt.Fprintln(os.Stderr, "faile to parse app version")
fmt.Fprintln(os.Stderr, "failed to parse app version")
fmt.Println("sda-cli version: ", ver)

return nil
}
ghVer, err := version.NewVersion(ghVersion.Name)
if err != nil {
fmt.Fprintln(os.Stderr, "faile to parse release version")
fmt.Fprintln(os.Stderr, "failed to parse release version")
fmt.Println("sda-cli version: ", ver)

return nil
}

if appVer.LessThan(ghVer) {
pt, _ := time.Parse(time.RFC3339, ghVersion.Published)
fmt.Printf("Newer version if sda-cli is avaiable, %s\n", ghVersion.Name)
fmt.Printf("Newer version of sda-cli is available, %s\n", ghVersion.Name)
fmt.Printf("Published: %s\n", pt.Format(time.DateTime))
fmt.Printf("Download it from here: %s\n", ghVersion.URL)

Expand Down
4 changes: 2 additions & 2 deletions version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (suite *VersionTests) TestGetVersion_newerAvailable() {
out, _ := io.ReadAll(r)
os.Stdout = storeStdout

assert.Contains(suite.T(), string(out), "Newer version if sda-cli is avaiable")
assert.Contains(suite.T(), string(out), "Newer version if sda-cli is available")
}

func (suite *VersionTests) TestGetVersion_badGateway() {
Expand All @@ -72,7 +72,7 @@ func (suite *VersionTests) TestGetVersion_badGateway() {
out, _ := io.ReadAll(r)
os.Stderr = storeStderr

assert.Equal(suite.T(), string(out), "failed to fetch releases, reson: 502 Bad Gateway\n")
assert.Equal(suite.T(), string(out), "failed to fetch releases, reason: 502 Bad Gateway\n")
}

func (suite *VersionTests) TestGetVersion_networkTimeout() {
Expand Down

0 comments on commit 7ad6477

Please sign in to comment.