From 72d53e46307eb6a88376f695d726bce461901ea2 Mon Sep 17 00:00:00 2001 From: Andy Grunwald Date: Wed, 29 Apr 2020 09:12:34 +0200 Subject: [PATCH] style: Adjust source code according gofmt -d -s Adjusting source code according to the go coding guidelines and simplify it a bit. --- error.go | 6 +++--- error_test.go | 6 +++--- issue_test.go | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/error.go b/error.go index bd1a5b9..03aae77 100644 --- a/error.go +++ b/error.go @@ -38,9 +38,9 @@ func NewJiraError(resp *Response, httpError error) error { return errors.Wrap(err, httpError.Error()) } } else { - if httpError == nil { - return fmt.Errorf("Got Response Status %s:%s", resp.Status, string(body)) - } + if httpError == nil { + return fmt.Errorf("Got Response Status %s:%s", resp.Status, string(body)) + } return errors.Wrap(httpError, fmt.Sprintf("%s: %s", resp.Status, string(body))) } diff --git a/error_test.go b/error_test.go index f010ee0..cd3ad22 100644 --- a/error_test.go +++ b/error_test.go @@ -67,7 +67,7 @@ func TestError_Unauthorized_NilError(t *testing.T) { defer teardown() testMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusUnauthorized) + w.WriteHeader(http.StatusUnauthorized) fmt.Fprint(w, `User is not authorized`) }) @@ -76,9 +76,9 @@ func TestError_Unauthorized_NilError(t *testing.T) { err := NewJiraError(resp, nil) msg := err.Error() - if !strings.Contains(msg, "401 Unauthorized:User is not authorized") { + if !strings.Contains(msg, "401 Unauthorized:User is not authorized") { t.Errorf("Expected Unauthorized HTTP status: Got\n%s\n", msg) - } + } } func TestError_BadJSON(t *testing.T) { diff --git a/issue_test.go b/issue_test.go index 21236a0..fa3f455 100644 --- a/issue_test.go +++ b/issue_test.go @@ -1018,7 +1018,7 @@ func TestIssueFields_MarshalJSON_Success(t *testing.T) { Key: "EX", }, AffectsVersions: []*AffectsVersion{ - &AffectsVersion{ + { ID: "10705", Name: "2.1.0-rc3", Self: "http://www.example.com/jira/rest/api/2/version/10705",