]> source.dussan.org Git - gitea.git/commitdiff
go vet
authorUnknown <joe2010xtmf@163.com>
Sun, 13 Apr 2014 07:14:43 +0000 (03:14 -0400)
committerUnknown <joe2010xtmf@163.com>
Sun, 13 Apr 2014 07:14:43 +0000 (03:14 -0400)
gogs.go
models/models_sqlite.go
models/update.go
modules/base/tool.go
modules/mailer/mail.go
modules/middleware/binding_test.go
modules/oauth2/oauth2.go

diff --git a/gogs.go b/gogs.go
index 1e614f495821612ed5fedc77c09f909bdcf756df..7a7d3ac873a6506849185397fe2a6b66eb458eed 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -1,3 +1,5 @@
+// +build go1.2
+
 // Copyright 2014 The Gogs Authors. All rights reserved.
 // Use of this source code is governed by a MIT-style
 // license that can be found in the LICENSE file.
@@ -14,8 +16,6 @@ import (
        "github.com/gogits/gogs/modules/base"
 )
 
-// +build go1.2
-
 // Test that go1.2 tag above is included in builds. main.go refers to this definition.
 const go12tag = true
 
index 1d80823fe5f48680dcd698bfbd7c96df59b656cd..c77e5ae5a66448f405224ae69c4f4c858a701f35 100644 (file)
@@ -1,9 +1,9 @@
+// +build sqlite
+
 // Copyright 2014 The Gogs Authors. All rights reserved.
 // Use of this source code is governed by a MIT-style
 // license that can be found in the LICENSE file.
 
-// +build sqlite
-
 package models
 
 import (
index 53591fa42eef523ed3a5a7ab58e9da447f0aebc2..ba0e979348d4d176ff054a322683136908965c9b 100644 (file)
@@ -39,12 +39,12 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId
        if isNew {
                l, err = newCommit.CommitsBefore()
                if err != nil {
-                       qlog.Fatalf("Find CommitsBefore erro:", err)
+                       qlog.Fatalf("Find CommitsBefore erro: %v", err)
                }
        } else {
                l, err = newCommit.CommitsBeforeUntil(oldCommitId)
                if err != nil {
-                       qlog.Fatalf("Find CommitsBeforeUntil erro:", err)
+                       qlog.Fatalf("Find CommitsBeforeUntil erro: %v", err)
                        return
                }
        }
index 0f06b3e0e24d47dd67e7444bef2f1c459686963a..082c0392502ca23c00983dc38b1b1e576c82b330 100644 (file)
@@ -284,7 +284,6 @@ func TimeSince(then time.Time) string {
        default:
                return fmt.Sprintf("%d years %s", diff/Year, lbl)
        }
-       return then.String()
 }
 
 const (
index d2bf1310a0b637659d0905f9a6f11767d7918f3e..834f4a898acb2f3521e9cd2f9795271923036cf6 100644 (file)
@@ -152,7 +152,7 @@ func SendIssueMentionMail(user, owner *models.User, repo *models.Repository, iss
        }
 
        issueLink := fmt.Sprintf("%s%s/%s/issues/%d", base.AppUrl, owner.Name, repo.Name, issue.Index)
-       body := fmt.Sprintf(`%s mentioned you.`)
+       body := fmt.Sprintf(`%s mentioned you.`, user.Name)
        subject := fmt.Sprintf("[%s] %s", repo.Name, issue.Name)
        content := fmt.Sprintf("%s<br>-<br> <a href=\"%s\">View it on Gogs</a>.", body, issueLink)
        msg := NewMailMessageFrom(tos, user.Name, subject, content)
index 654cef29f105368599daa541c7362e2f2f983b1e..2a74e1a6cc0ff394c2acebebbc643cdf7fb80d0f 100644 (file)
@@ -121,7 +121,7 @@ func handle(test testCase, t *testing.T, index int, post BlogPost, errors Errors
        if test.ok && errors.Count() > 0 {
                t.Errorf("%+v should be OK (0 errors), but had errors: %+v", test, errors)
        } else if !test.ok && errors.Count() == 0 {
-               t.Errorf("%+v should have errors, but was OK (0 errors): %+v", test)
+               t.Errorf("%+v should have errors, but was OK (0 errors)", test)
        }
 }
 
@@ -132,7 +132,7 @@ func handleEmpty(test emptyPayloadTestCase, t *testing.T, index int, section Blo
        if test.ok && errors.Count() > 0 {
                t.Errorf("%+v should be OK (0 errors), but had errors: %+v", test, errors)
        } else if !test.ok && errors.Count() == 0 {
-               t.Errorf("%+v should have errors, but was OK (0 errors): %+v", test)
+               t.Errorf("%+v should have errors, but was OK (0 errors)", test)
        }
 }
 
index 05ae4606a540bea49525e1195d66ebc0b108cbd5..dcb6d0a434f047c98d9bb7c3a0027a6cbf684b2e 100644 (file)
@@ -9,7 +9,6 @@ package oauth2
 
 import (
        "encoding/json"
-       "fmt"
        "net/http"
        "net/url"
        "strings"
@@ -95,11 +94,6 @@ func (t *token) ExpiryTime() time.Time {
        return t.Expiry
 }
 
-// Formats tokens into string.
-func (t *token) String() string {
-       return fmt.Sprintf("tokens: %v", t)
-}
-
 // Returns a new Google OAuth 2.0 backend endpoint.
 func Google(opts *Options) martini.Handler {
        opts.AuthUrl = "https://accounts.google.com/o/oauth2/auth"