From 9d983f27d69b72f42eeb833cb0f38e78e3819839 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sun, 13 Apr 2014 03:14:43 -0400 Subject: [PATCH] go vet --- gogs.go | 4 ++-- models/models_sqlite.go | 4 ++-- models/update.go | 4 ++-- modules/base/tool.go | 1 - modules/mailer/mail.go | 2 +- modules/middleware/binding_test.go | 4 ++-- modules/oauth2/oauth2.go | 6 ------ 7 files changed, 9 insertions(+), 16 deletions(-) diff --git a/gogs.go b/gogs.go index 1e614f4958..7a7d3ac873 100644 --- 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 diff --git a/models/models_sqlite.go b/models/models_sqlite.go index 1d80823fe5..c77e5ae5a6 100644 --- a/models/models_sqlite.go +++ b/models/models_sqlite.go @@ -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 ( diff --git a/models/update.go b/models/update.go index 53591fa42e..ba0e979348 100644 --- a/models/update.go +++ b/models/update.go @@ -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 } } diff --git a/modules/base/tool.go b/modules/base/tool.go index 0f06b3e0e2..082c039250 100644 --- a/modules/base/tool.go +++ b/modules/base/tool.go @@ -284,7 +284,6 @@ func TimeSince(then time.Time) string { default: return fmt.Sprintf("%d years %s", diff/Year, lbl) } - return then.String() } const ( diff --git a/modules/mailer/mail.go b/modules/mailer/mail.go index d2bf1310a0..834f4a898a 100644 --- a/modules/mailer/mail.go +++ b/modules/mailer/mail.go @@ -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
-
View it on Gogs.", body, issueLink) msg := NewMailMessageFrom(tos, user.Name, subject, content) diff --git a/modules/middleware/binding_test.go b/modules/middleware/binding_test.go index 654cef29f1..2a74e1a6cc 100644 --- a/modules/middleware/binding_test.go +++ b/modules/middleware/binding_test.go @@ -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) } } diff --git a/modules/oauth2/oauth2.go b/modules/oauth2/oauth2.go index 05ae4606a5..dcb6d0a434 100644 --- a/modules/oauth2/oauth2.go +++ b/modules/oauth2/oauth2.go @@ -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"