diff options
author | zeripath <art27@cantab.net> | 2020-03-30 19:52:45 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-30 21:52:45 +0300 |
commit | bf847b9397b0365a81d1a2ca5386a6c4280d9e94 (patch) | |
tree | a902635a79aeb9442381d9d9741095b15a9e8721 | |
parent | 972b3bf3b0b772dd919333375356ae56e469ebea (diff) | |
download | gitea-bf847b9397b0365a81d1a2ca5386a6c4280d9e94.tar.gz gitea-bf847b9397b0365a81d1a2ca5386a6c4280d9e94.zip |
Upgrade golangci-lint to 1.24.0 (#10894)
* upgrade golangci-lint to 1.24.0 to allow go 1.14 compatibility
* fix golangci-lint errors
* make make golangci-lint work when out of go-path
Signed-off-by: Andrew Thornton <art27@cantab.net>
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | models/error.go | 6 | ||||
-rw-r--r-- | models/notification.go | 2 | ||||
-rw-r--r-- | modules/private/key.go | 2 | ||||
-rw-r--r-- | modules/private/manager.go | 6 | ||||
-rw-r--r-- | routers/repo/compare.go | 1 | ||||
-rw-r--r-- | routers/repo/pull_review.go | 11 |
7 files changed, 16 insertions, 16 deletions
@@ -621,6 +621,6 @@ pr\#%: clean-all golangci-lint: @hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ export BINARY="golangci-lint"; \ - curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.20.0; \ + curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.24.0; \ fi - golangci-lint run --timeout 5m + env GO111MODULE=on golangci-lint run --timeout 5m diff --git a/models/error.go b/models/error.go index a5b62b85ec..f53479fac8 100644 --- a/models/error.go +++ b/models/error.go @@ -227,7 +227,7 @@ func IsErrUserNotAllowedCreateOrg(err error) bool { } func (err ErrUserNotAllowedCreateOrg) Error() string { - return fmt.Sprintf("user is not allowed to create organizations") + return "user is not allowed to create organizations" } // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error. @@ -561,7 +561,7 @@ func IsErrAccessTokenEmpty(err error) bool { } func (err ErrAccessTokenEmpty) Error() string { - return fmt.Sprintf("access token is empty") + return "access token is empty" } // ________ .__ __ .__ @@ -1107,7 +1107,7 @@ func IsErrSHAOrCommitIDNotProvided(err error) bool { } func (err ErrSHAOrCommitIDNotProvided) Error() string { - return fmt.Sprintf("a SHA or commmit ID must be proved when updating a file") + return "a SHA or commmit ID must be proved when updating a file" } // __ __ ___. .__ __ diff --git a/models/notification.go b/models/notification.go index daf13faf87..0cee8616ca 100644 --- a/models/notification.go +++ b/models/notification.go @@ -611,7 +611,7 @@ func (nl NotificationList) LoadIssues() ([]int, error) { // Without returns the notification list without the failures func (nl NotificationList) Without(failures []int) NotificationList { - if failures == nil || len(failures) == 0 { + if len(failures) == 0 { return nl } remaining := make([]*Notification, 0, len(nl)) diff --git a/modules/private/key.go b/modules/private/key.go index 40e1c492f8..bea7837906 100644 --- a/modules/private/key.go +++ b/modules/private/key.go @@ -34,7 +34,7 @@ func UpdatePublicKeyInRepo(keyID, repoID int64) error { // and returns public key found. func AuthorizedPublicKeyByContent(content string) (string, error) { // Ask for running deliver hook and test pull request tasks. - reqURL := setting.LocalURL + fmt.Sprintf("api/internal/ssh/authorized_keys") + reqURL := setting.LocalURL + "api/internal/ssh/authorized_keys" req := newInternalRequest(reqURL, "POST") req.Param("content", content) resp, err := req.Response() diff --git a/modules/private/manager.go b/modules/private/manager.go index de46c7ab2c..503acf17d6 100644 --- a/modules/private/manager.go +++ b/modules/private/manager.go @@ -15,7 +15,7 @@ import ( // Shutdown calls the internal shutdown function func Shutdown() (int, string) { - reqURL := setting.LocalURL + fmt.Sprintf("api/internal/manager/shutdown") + reqURL := setting.LocalURL + "api/internal/manager/shutdown" req := newInternalRequest(reqURL, "POST") resp, err := req.Response() @@ -33,7 +33,7 @@ func Shutdown() (int, string) { // Restart calls the internal restart function func Restart() (int, string) { - reqURL := setting.LocalURL + fmt.Sprintf("api/internal/manager/restart") + reqURL := setting.LocalURL + "api/internal/manager/restart" req := newInternalRequest(reqURL, "POST") resp, err := req.Response() @@ -57,7 +57,7 @@ type FlushOptions struct { // FlushQueues calls the internal flush-queues function func FlushQueues(timeout time.Duration, nonBlocking bool) (int, string) { - reqURL := setting.LocalURL + fmt.Sprintf("api/internal/manager/flush-queues") + reqURL := setting.LocalURL + "api/internal/manager/flush-queues" req := newInternalRequest(reqURL, "POST") if timeout > 0 { diff --git a/routers/repo/compare.go b/routers/repo/compare.go index 4769a4da1a..815ec35650 100644 --- a/routers/repo/compare.go +++ b/routers/repo/compare.go @@ -422,7 +422,6 @@ func CompareDiff(ctx *context.Context) { beforeCommitID := ctx.Data["BeforeCommitID"].(string) afterCommitID := ctx.Data["AfterCommitID"].(string) - ctx.Data["Title"] = "Comparing " + base.ShortSha(beforeCommitID) + "..." + base.ShortSha(afterCommitID) ctx.Data["IsRepoToolbarCommits"] = true diff --git a/routers/repo/pull_review.go b/routers/repo/pull_review.go index 9fcb02cd4a..0f5375dc16 100644 --- a/routers/repo/pull_review.go +++ b/routers/repo/pull_review.go @@ -51,13 +51,14 @@ func CreateCodeComment(ctx *context.Context, form auth.CodeCommentForm) { return } - log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID) - - if comment != nil { - ctx.Redirect(comment.HTMLURL()) - } else { + if comment == nil { + log.Trace("Comment not created: %-v #%d[%d]", ctx.Repo.Repository, issue.Index, issue.ID) ctx.Redirect(fmt.Sprintf("%s/pulls/%d/files", ctx.Repo.RepoLink, issue.Index)) + return } + + log.Trace("Comment created: %-v #%d[%d] Comment[%d]", ctx.Repo.Repository, issue.Index, issue.ID, comment.ID) + ctx.Redirect(comment.HTMLURL()) } // SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist |