go vet
This commit is contained in:
parent
5c2da610a2
commit
9d983f27d6
4
gogs.go
4
gogs.go
|
@ -1,3 +1,5 @@
|
||||||
|
// +build go1.2
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
@ -14,8 +16,6 @@ import (
|
||||||
"github.com/gogits/gogs/modules/base"
|
"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.
|
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
|
||||||
const go12tag = true
|
const go12tag = true
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
// +build sqlite
|
||||||
|
|
||||||
// Copyright 2014 The Gogs Authors. All rights reserved.
|
// Copyright 2014 The Gogs Authors. All rights reserved.
|
||||||
// Use of this source code is governed by a MIT-style
|
// Use of this source code is governed by a MIT-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build sqlite
|
|
||||||
|
|
||||||
package models
|
package models
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
|
|
@ -39,12 +39,12 @@ func Update(refName, oldCommitId, newCommitId, userName, repoName string, userId
|
||||||
if isNew {
|
if isNew {
|
||||||
l, err = newCommit.CommitsBefore()
|
l, err = newCommit.CommitsBefore()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
qlog.Fatalf("Find CommitsBefore erro:", err)
|
qlog.Fatalf("Find CommitsBefore erro: %v", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
l, err = newCommit.CommitsBeforeUntil(oldCommitId)
|
l, err = newCommit.CommitsBeforeUntil(oldCommitId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
qlog.Fatalf("Find CommitsBeforeUntil erro:", err)
|
qlog.Fatalf("Find CommitsBeforeUntil erro: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -284,7 +284,6 @@ func TimeSince(then time.Time) string {
|
||||||
default:
|
default:
|
||||||
return fmt.Sprintf("%d years %s", diff/Year, lbl)
|
return fmt.Sprintf("%d years %s", diff/Year, lbl)
|
||||||
}
|
}
|
||||||
return then.String()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
|
|
@ -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)
|
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)
|
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)
|
content := fmt.Sprintf("%s<br>-<br> <a href=\"%s\">View it on Gogs</a>.", body, issueLink)
|
||||||
msg := NewMailMessageFrom(tos, user.Name, subject, content)
|
msg := NewMailMessageFrom(tos, user.Name, subject, content)
|
||||||
|
|
|
@ -121,7 +121,7 @@ func handle(test testCase, t *testing.T, index int, post BlogPost, errors Errors
|
||||||
if test.ok && errors.Count() > 0 {
|
if test.ok && errors.Count() > 0 {
|
||||||
t.Errorf("%+v should be OK (0 errors), but had errors: %+v", test, errors)
|
t.Errorf("%+v should be OK (0 errors), but had errors: %+v", test, errors)
|
||||||
} else if !test.ok && errors.Count() == 0 {
|
} 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 {
|
if test.ok && errors.Count() > 0 {
|
||||||
t.Errorf("%+v should be OK (0 errors), but had errors: %+v", test, errors)
|
t.Errorf("%+v should be OK (0 errors), but had errors: %+v", test, errors)
|
||||||
} else if !test.ok && errors.Count() == 0 {
|
} 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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ package oauth2
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -95,11 +94,6 @@ func (t *token) ExpiryTime() time.Time {
|
||||||
return t.Expiry
|
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.
|
// Returns a new Google OAuth 2.0 backend endpoint.
|
||||||
func Google(opts *Options) martini.Handler {
|
func Google(opts *Options) martini.Handler {
|
||||||
opts.AuthUrl = "https://accounts.google.com/o/oauth2/auth"
|
opts.AuthUrl = "https://accounts.google.com/o/oauth2/auth"
|
||||||
|
|
Loading…
Reference in New Issue