fix gofmt error
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
parent
d0490c187c
commit
6510e57758
7 changed files with 27 additions and 28 deletions
|
@ -20,16 +20,16 @@ func assertLineEqual(t *testing.T, d1 *DiffLine, d2 *DiffLine) {
|
||||||
|
|
||||||
func TestDiffToHTML(t *testing.T) {
|
func TestDiffToHTML(t *testing.T) {
|
||||||
assertEqual(t, "+foo <span class=\"added-code\">bar</span> biz", diffToHTML([]dmp.Diff{
|
assertEqual(t, "+foo <span class=\"added-code\">bar</span> biz", diffToHTML([]dmp.Diff{
|
||||||
dmp.Diff{dmp.DiffEqual, "foo "},
|
{dmp.DiffEqual, "foo "},
|
||||||
dmp.Diff{dmp.DiffInsert, "bar"},
|
{dmp.DiffInsert, "bar"},
|
||||||
dmp.Diff{dmp.DiffDelete, " baz"},
|
{dmp.DiffDelete, " baz"},
|
||||||
dmp.Diff{dmp.DiffEqual, " biz"},
|
{dmp.DiffEqual, " biz"},
|
||||||
}, DiffLineAdd))
|
}, DiffLineAdd))
|
||||||
|
|
||||||
assertEqual(t, "-foo <span class=\"removed-code\">bar</span> biz", diffToHTML([]dmp.Diff{
|
assertEqual(t, "-foo <span class=\"removed-code\">bar</span> biz", diffToHTML([]dmp.Diff{
|
||||||
dmp.Diff{dmp.DiffEqual, "foo "},
|
{dmp.DiffEqual, "foo "},
|
||||||
dmp.Diff{dmp.DiffDelete, "bar"},
|
{dmp.DiffDelete, "bar"},
|
||||||
dmp.Diff{dmp.DiffInsert, " baz"},
|
{dmp.DiffInsert, " baz"},
|
||||||
dmp.Diff{dmp.DiffEqual, " biz"},
|
{dmp.DiffEqual, " biz"},
|
||||||
}, DiffLineDel))
|
}, DiffLineDel))
|
||||||
}
|
}
|
||||||
|
|
|
@ -1202,8 +1202,8 @@ func GetIssueStats(opts *IssueStatsOptions) *IssueStats {
|
||||||
|
|
||||||
if opts.MentionedID > 0 {
|
if opts.MentionedID > 0 {
|
||||||
sess.Join("INNER", "issue_user", "issue.id = issue_user.issue_id").
|
sess.Join("INNER", "issue_user", "issue.id = issue_user.issue_id").
|
||||||
And("issue_user.uid = ?", opts.MentionedID).
|
And("issue_user.uid = ?", opts.MentionedID).
|
||||||
And("issue_user.is_mentioned = ?", true)
|
And("issue_user.is_mentioned = ?", true)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sess
|
return sess
|
||||||
|
|
|
@ -156,15 +156,15 @@ func parsePostgreSQLHostPort(info string) (string, string) {
|
||||||
|
|
||||||
func parseMSSQLHostPort(info string) (string, string) {
|
func parseMSSQLHostPort(info string) (string, string) {
|
||||||
host, port := "127.0.0.1", "1433"
|
host, port := "127.0.0.1", "1433"
|
||||||
if strings.Contains(info, ":") {
|
if strings.Contains(info, ":") {
|
||||||
host = strings.Split(info, ":")[0]
|
host = strings.Split(info, ":")[0]
|
||||||
port = strings.Split(info, ":")[1]
|
port = strings.Split(info, ":")[1]
|
||||||
} else if strings.Contains(info, ",") {
|
} else if strings.Contains(info, ",") {
|
||||||
host = strings.Split(info, ",")[0]
|
host = strings.Split(info, ",")[0]
|
||||||
port = strings.TrimSpace(strings.Split(info, ",")[1])
|
port = strings.TrimSpace(strings.Split(info, ",")[1])
|
||||||
} else if len(info) > 0 {
|
} else if len(info) > 0 {
|
||||||
host = info
|
host = info
|
||||||
}
|
}
|
||||||
return host, port
|
return host, port
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -90,5 +90,5 @@ func transformKey(key string) string {
|
||||||
return key
|
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:])
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,12 +220,12 @@ func (s *sendmailSender) Send(from string, to []string, msg io.WriterTo) error {
|
||||||
return err
|
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
|
// 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
|
// Also we should wait on our sendmail command even if something fails
|
||||||
closeError = pipe.Close()
|
closeError = pipe.Close()
|
||||||
waitError = cmd.Wait()
|
waitError = cmd.Wait()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
} else if closeError != nil {
|
} else if closeError != nil {
|
||||||
|
@ -263,7 +263,6 @@ func NewContext() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if setting.MailService.UseSendmail {
|
if setting.MailService.UseSendmail {
|
||||||
Sender = &sendmailSender{}
|
Sender = &sendmailSender{}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -94,7 +94,7 @@ func HTTP(ctx *context.Context) {
|
||||||
ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName")
|
ctx.HandleText(401, "reverse proxy login error, got error while running GetUserByName")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
authHead := ctx.Req.Header.Get("Authorization")
|
authHead := ctx.Req.Header.Get("Authorization")
|
||||||
if len(authHead) == 0 {
|
if len(authHead) == 0 {
|
||||||
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"")
|
ctx.Resp.Header().Set("WWW-Authenticate", "Basic realm=\".\"")
|
||||||
|
|
|
@ -132,10 +132,10 @@ func Issues(ctx *context.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
assigneeID = ctx.QueryInt64("assignee")
|
assigneeID = ctx.QueryInt64("assignee")
|
||||||
posterID int64
|
posterID int64
|
||||||
mentionedID int64
|
mentionedID int64
|
||||||
forceEmpty bool
|
forceEmpty bool
|
||||||
)
|
)
|
||||||
switch viewType {
|
switch viewType {
|
||||||
case "assigned":
|
case "assigned":
|
||||||
|
|
Reference in a new issue