mirror of
https://github.com/interviewstreet/go-jira.git
synced 2025-05-13 21:56:42 +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:
parent
8c77107df3
commit
72d53e4630
6
error.go
6
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)))
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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",
|
||||
|
Loading…
x
Reference in New Issue
Block a user