Error strings noncapitalized (#1704)

* Fix error string capitalization

Error strings often follow another string. Hence, they should not be
capitalized, unless referencing a name.

* Uncapitalize more error strings

While here, use %v on the error directly, which makes it easier to wrap
the error later with %w if need be.

* Uncapitalize more error strings

While here, rename Url to URL as a nitpick.
This commit is contained in:
SmallCoccinelle
2021-09-08 03:23:10 +02:00
committed by GitHub
parent d2a0a8fe4c
commit e7f6cb22b7
10 changed files with 26 additions and 19 deletions

View File

@@ -117,10 +117,12 @@ func makeGithubRequest(url string, output interface{}) error {
response, err := client.Do(req)
if err != nil {
//lint:ignore ST1005 Github is a proper capitalized noun
return fmt.Errorf("Github API request failed: %s", err)
}
if response.StatusCode != http.StatusOK {
//lint:ignore ST1005 Github is a proper capitalized noun
return fmt.Errorf("Github API request failed: %s", response.Status)
}
@@ -128,12 +130,13 @@ func makeGithubRequest(url string, output interface{}) error {
data, err := ioutil.ReadAll(response.Body)
if err != nil {
//lint:ignore ST1005 Github is a proper capitalized noun
return fmt.Errorf("Github API read response failed: %s", err)
}
err = json.Unmarshal(data, output)
if err != nil {
return fmt.Errorf("Unmarshalling Github API response failed: %s", err)
return fmt.Errorf("unmarshalling Github API response failed: %s", err)
}
return nil
@@ -196,7 +199,7 @@ func GetLatestVersion(shortHash bool) (latestVersion string, latestRelease strin
}
if latestVersion == "" {
return "", "", fmt.Errorf("No version found for \"%s\"", version)
return "", "", fmt.Errorf("no version found for \"%s\"", version)
}
return latestVersion, latestRelease, nil
}