Skip to content

Commit

Permalink
Merge pull request #197 from shogo82148/fix-lint-warnings-2021-05-25
Browse files Browse the repository at this point in the history
Fix lint warnings
  • Loading branch information
shogo82148 committed May 25, 2021
2 parents 136ad10 + e0e680b commit 394f78c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
7 changes: 0 additions & 7 deletions gitinfo.go
Expand Up @@ -119,13 +119,6 @@ func runCommand(gitPath string, args ...string) (string, error) {
return string(ret), nil
}

func firstLine(s string) string {
if idx := strings.Index(s, "\n"); idx >= 0 {
return s[:idx]
}
return s
}

var varNames = [...]string{
"GIT_BRANCH",

Expand Down
12 changes: 6 additions & 6 deletions goveralls.go
Expand Up @@ -265,7 +265,7 @@ func processParallelFinish(jobID, token string) error {
defer res.Body.Close()
bodyBytes, err := ioutil.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("Unable to read response body from coveralls: %s", err)
return fmt.Errorf("unable to read response body from coveralls: %s", err)
}

if res.StatusCode >= http.StatusInternalServerError && *shallow {
Expand All @@ -274,12 +274,12 @@ func processParallelFinish(jobID, token string) error {
}

if res.StatusCode != 200 {
return fmt.Errorf("Bad response status from coveralls: %d\n%s", res.StatusCode, bodyBytes)
return fmt.Errorf("bad response status from coveralls: %d\n%s", res.StatusCode, bodyBytes)
}

var response WebHookResponse
if err = json.Unmarshal(bodyBytes, &response); err != nil {
return fmt.Errorf("Unable to unmarshal response JSON from coveralls: %s\n%s", err, bodyBytes)
return fmt.Errorf("unable to unmarshal response JSON from coveralls: %s\n%s", err, bodyBytes)
}

if !response.Done {
Expand Down Expand Up @@ -499,7 +499,7 @@ func process() error {
defer res.Body.Close()
bodyBytes, err := ioutil.ReadAll(res.Body)
if err != nil {
return fmt.Errorf("Unable to read response body from coveralls: %s", err)
return fmt.Errorf("unable to read response body from coveralls: %s", err)
}

if res.StatusCode >= http.StatusInternalServerError && *shallow {
Expand All @@ -508,11 +508,11 @@ func process() error {
}

if res.StatusCode != 200 {
return fmt.Errorf("Bad response status from coveralls: %d\n%s", res.StatusCode, bodyBytes)
return fmt.Errorf("bad response status from coveralls: %d\n%s", res.StatusCode, bodyBytes)
}
var response Response
if err = json.Unmarshal(bodyBytes, &response); err != nil {
return fmt.Errorf("Unable to unmarshal response JSON from coveralls: %s\n%s", err, bodyBytes)
return fmt.Errorf("unable to unmarshal response JSON from coveralls: %s\n%s", err, bodyBytes)
}
if response.Error {
return errors.New(response.Message)
Expand Down
4 changes: 4 additions & 0 deletions goveralls_test.go
Expand Up @@ -54,6 +54,10 @@ func fakeServer() *httptest.Server {
func fakeServerWithPayloadChannel(payload chan Job) *httptest.Server {
return httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
body, err := ioutil.ReadAll(r.Body)
if err != nil {
w.WriteHeader(http.StatusInternalServerError)
return
}
// query params are used for the body payload
vals, err := url.ParseQuery(string(body))
if err != nil {
Expand Down

0 comments on commit 394f78c

Please sign in to comment.