From 6510e5775896343f0a69c47ad31c439c7310ff34 Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Fri, 30 Dec 2016 15:26:05 +0800 Subject: [PATCH] fix gofmt error Signed-off-by: Bo-Yi Wu --- models/git_diff_test.go | 16 ++++++++-------- models/issue.go | 4 ++-- models/models.go | 18 +++++++++--------- modules/lfs/content_store.go | 2 +- modules/mailer/mailer.go | 5 ++--- routers/repo/http.go | 2 +- routers/repo/issue.go | 8 ++++---- 7 files changed, 27 insertions(+), 28 deletions(-) diff --git a/models/git_diff_test.go b/models/git_diff_test.go index cf98f65399..f88e6fb610 100644 --- a/models/git_diff_test.go +++ b/models/git_diff_test.go @@ -20,16 +20,16 @@ func assertLineEqual(t *testing.T, d1 *DiffLine, d2 *DiffLine) { func TestDiffToHTML(t *testing.T) { assertEqual(t, "+foo bar biz", diffToHTML([]dmp.Diff{ - dmp.Diff{dmp.DiffEqual, "foo "}, - dmp.Diff{dmp.DiffInsert, "bar"}, - dmp.Diff{dmp.DiffDelete, " baz"}, - dmp.Diff{dmp.DiffEqual, " biz"}, + {dmp.DiffEqual, "foo "}, + {dmp.DiffInsert, "bar"}, + {dmp.DiffDelete, " baz"}, + {dmp.DiffEqual, " biz"}, }, DiffLineAdd)) assertEqual(t, "-foo bar biz", diffToHTML([]dmp.Diff{ - dmp.Diff{dmp.DiffEqual, "foo "}, - dmp.Diff{dmp.DiffDelete, "bar"}, - dmp.Diff{dmp.DiffInsert, " baz"}, - dmp.Diff{dmp.DiffEqual, " biz"}, + {dmp.DiffEqual, "foo "}, + {dmp.DiffDelete, "bar"}, + {dmp.DiffInsert, " baz"}, + {dmp.DiffEqual, " biz"}, }, DiffLineDel)) } diff --git a/models/issue.go b/models/issue.go index 6303911808..315c91e159 100644 --- a/models/issue.go +++ b/models/issue.go @@ -1202,8 +1202,8 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats { if opts.MentionedID > 0 { sess.Join("INNER", "issue_user", "issue.id = issue_user.issue_id"). - And("issue_user.uid = ?", opts.MentionedID). - And("issue_user.is_mentioned = ?", true) + And("issue_user.uid = ?", opts.MentionedID). + And("issue_user.is_mentioned = ?", true) } return sess diff --git a/models/models.go b/models/models.go index 1bebaa602c..e937580d18 100644 --- a/models/models.go +++ b/models/models.go @@ -156,15 +156,15 @@ func parsePostgreSQLHostPort(info string) (string, string) { func parseMSSQLHostPort(info string) (string, string) { host, port := "127.0.0.1", "1433" - if strings.Contains(info, ":") { - host = strings.Split(info, ":")[0] - port = strings.Split(info, ":")[1] - } else if strings.Contains(info, ",") { - host = strings.Split(info, ",")[0] - port = strings.TrimSpace(strings.Split(info, ",")[1]) - } else if len(info) > 0 { - host = info - } + if strings.Contains(info, ":") { + host = strings.Split(info, ":")[0] + port = strings.Split(info, ":")[1] + } else if strings.Contains(info, ",") { + host = strings.Split(info, ",")[0] + port = strings.TrimSpace(strings.Split(info, ",")[1]) + } else if len(info) > 0 { + host = info + } return host, port } diff --git a/modules/lfs/content_store.go b/modules/lfs/content_store.go index 2ca44512f1..7a1f1b44b5 100644 --- a/modules/lfs/content_store.go +++ b/modules/lfs/content_store.go @@ -90,5 +90,5 @@ func transformKey(key string) string { return key } - return filepath.Join(key[0:2], key[2:4], key[4:len(key)]) + return filepath.Join(key[0:2], key[2:4], key[4:]) } diff --git a/modules/mailer/mailer.go b/modules/mailer/mailer.go index 3201075f3f..fd1a5db14f 100644 --- a/modules/mailer/mailer.go +++ b/modules/mailer/mailer.go @@ -220,12 +220,12 @@ func (s *sendmailSender) Send(from string, to []string, msg io.WriterTo) error { return err } - _,err = msg.WriteTo(pipe) + _, err = msg.WriteTo(pipe) // we MUST close the pipe or sendmail will hang waiting for more of the message // Also we should wait on our sendmail command even if something fails closeError = pipe.Close() - waitError = cmd.Wait() + waitError = cmd.Wait() if err != nil { return err } else if closeError != nil { @@ -263,7 +263,6 @@ func NewContext() { return } - if setting.MailService.UseSendmail { Sender = &sendmailSender{} } else { diff --git a/routers/repo/http.go b/routers/repo/http.go index 6b4dec8149..695e758cdb 100644 --- a/routers/repo/http.go +++ b/routers/repo/http.go @@ -94,7 +94,7 @@ func HTTP(ctx *context.Context) { ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName") return } - }else{ + } else { authHead := ctx.Req.Header.Get("Authorization") if len(authHead) == 0 { ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"") diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 049eac06c3..edc6219d33 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -132,10 +132,10 @@ func Issues(ctx *context.Context) { } var ( - assigneeID = ctx.QueryInt64("assignee") - posterID int64 - mentionedID int64 - forceEmpty bool + assigneeID = ctx.QueryInt64("assignee") + posterID int64 + mentionedID int64 + forceEmpty bool ) switch viewType { case "assigned":