1
0
mirror of https://github.com/interviewstreet/go-jira.git synced 2025-05-15 22:06:45 +02:00

style: Adjust source code according gofmt -d -s

Adjusting source code according to the go coding guidelines
and simplify it a bit.
This commit is contained in:
Andy Grunwald 2020-04-29 09:12:34 +02:00 committed by Wes McNamee
parent 8c77107df3
commit 72d53e4630
3 changed files with 7 additions and 7 deletions

View File

@ -38,9 +38,9 @@ func NewJiraError(resp *Response, httpError error) error {
return errors.Wrap(err, httpError.Error()) return errors.Wrap(err, httpError.Error())
} }
} else { } else {
if httpError == nil { if httpError == nil {
return fmt.Errorf("Got Response Status %s:%s", resp.Status, string(body)) return fmt.Errorf("Got Response Status %s:%s", resp.Status, string(body))
} }
return errors.Wrap(httpError, fmt.Sprintf("%s: %s", resp.Status, string(body))) return errors.Wrap(httpError, fmt.Sprintf("%s: %s", resp.Status, string(body)))
} }

View File

@ -67,7 +67,7 @@ func TestError_Unauthorized_NilError(t *testing.T) {
defer teardown() defer teardown()
testMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { testMux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusUnauthorized) w.WriteHeader(http.StatusUnauthorized)
fmt.Fprint(w, `User is not authorized`) fmt.Fprint(w, `User is not authorized`)
}) })
@ -76,9 +76,9 @@ func TestError_Unauthorized_NilError(t *testing.T) {
err := NewJiraError(resp, nil) err := NewJiraError(resp, nil)
msg := err.Error() 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) t.Errorf("Expected Unauthorized HTTP status: Got\n%s\n", msg)
} }
} }
func TestError_BadJSON(t *testing.T) { func TestError_BadJSON(t *testing.T) {

View File

@ -1018,7 +1018,7 @@ func TestIssueFields_MarshalJSON_Success(t *testing.T) {
Key: "EX", Key: "EX",
}, },
AffectsVersions: []*AffectsVersion{ AffectsVersions: []*AffectsVersion{
&AffectsVersion{ {
ID: "10705", ID: "10705",
Name: "2.1.0-rc3", Name: "2.1.0-rc3",
Self: "http://www.example.com/jira/rest/api/2/version/10705", Self: "http://www.example.com/jira/rest/api/2/version/10705",