Skip to content

Commit bf847b9

Browse files
authored
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 <[email protected]>
1 parent 972b3bf commit bf847b9

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,6 +621,6 @@ pr\#%: clean-all
621621
golangci-lint:
622622
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
623623
export BINARY="golangci-lint"; \
624-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.20.0; \
624+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.24.0; \
625625
fi
626-
golangci-lint run --timeout 5m
626+
env GO111MODULE=on golangci-lint run --timeout 5m

models/error.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ func IsErrUserNotAllowedCreateOrg(err error) bool {
227227
}
228228

229229
func (err ErrUserNotAllowedCreateOrg) Error() string {
230-
return fmt.Sprintf("user is not allowed to create organizations")
230+
return "user is not allowed to create organizations"
231231
}
232232

233233
// ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
@@ -561,7 +561,7 @@ func IsErrAccessTokenEmpty(err error) bool {
561561
}
562562

563563
func (err ErrAccessTokenEmpty) Error() string {
564-
return fmt.Sprintf("access token is empty")
564+
return "access token is empty"
565565
}
566566

567567
// ________ .__ __ .__
@@ -1107,7 +1107,7 @@ func IsErrSHAOrCommitIDNotProvided(err error) bool {
11071107
}
11081108

11091109
func (err ErrSHAOrCommitIDNotProvided) Error() string {
1110-
return fmt.Sprintf("a SHA or commmit ID must be proved when updating a file")
1110+
return "a SHA or commmit ID must be proved when updating a file"
11111111
}
11121112

11131113
// __ __ ___. .__ __

models/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ func (nl NotificationList) LoadIssues() ([]int, error) {
611611

612612
// Without returns the notification list without the failures
613613
func (nl NotificationList) Without(failures []int) NotificationList {
614-
if failures == nil || len(failures) == 0 {
614+
if len(failures) == 0 {
615615
return nl
616616
}
617617
remaining := make([]*Notification, 0, len(nl))

modules/private/key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func UpdatePublicKeyInRepo(keyID, repoID int64) error {
3434
// and returns public key found.
3535
func AuthorizedPublicKeyByContent(content string) (string, error) {
3636
// Ask for running deliver hook and test pull request tasks.
37-
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/ssh/authorized_keys")
37+
reqURL := setting.LocalURL + "api/internal/ssh/authorized_keys"
3838
req := newInternalRequest(reqURL, "POST")
3939
req.Param("content", content)
4040
resp, err := req.Response()

modules/private/manager.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515

1616
// Shutdown calls the internal shutdown function
1717
func Shutdown() (int, string) {
18-
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/manager/shutdown")
18+
reqURL := setting.LocalURL + "api/internal/manager/shutdown"
1919

2020
req := newInternalRequest(reqURL, "POST")
2121
resp, err := req.Response()
@@ -33,7 +33,7 @@ func Shutdown() (int, string) {
3333

3434
// Restart calls the internal restart function
3535
func Restart() (int, string) {
36-
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/manager/restart")
36+
reqURL := setting.LocalURL + "api/internal/manager/restart"
3737

3838
req := newInternalRequest(reqURL, "POST")
3939
resp, err := req.Response()
@@ -57,7 +57,7 @@ type FlushOptions struct {
5757

5858
// FlushQueues calls the internal flush-queues function
5959
func FlushQueues(timeout time.Duration, nonBlocking bool) (int, string) {
60-
reqURL := setting.LocalURL + fmt.Sprintf("api/internal/manager/flush-queues")
60+
reqURL := setting.LocalURL + "api/internal/manager/flush-queues"
6161

6262
req := newInternalRequest(reqURL, "POST")
6363
if timeout > 0 {

routers/repo/compare.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,6 @@ func CompareDiff(ctx *context.Context) {
422422
beforeCommitID := ctx.Data["BeforeCommitID"].(string)
423423
afterCommitID := ctx.Data["AfterCommitID"].(string)
424424

425-
426425
ctx.Data["Title"] = "Comparing " + base.ShortSha(beforeCommitID) + "..." + base.ShortSha(afterCommitID)
427426

428427
ctx.Data["IsRepoToolbarCommits"] = true

routers/repo/pull_review.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ func CreateCodeComment(ctx *context.Context, form auth.CodeCommentForm) {
5151
return
5252
}
5353

54-
log.Trace("Comment created: %d/%d/%d", ctx.Repo.Repository.ID, issue.ID, comment.ID)
55-
56-
if comment != nil {
57-
ctx.Redirect(comment.HTMLURL())
58-
} else {
54+
if comment == nil {
55+
log.Trace("Comment not created: %-v #%d[%d]", ctx.Repo.Repository, issue.Index, issue.ID)
5956
ctx.Redirect(fmt.Sprintf("%s/pulls/%d/files", ctx.Repo.RepoLink, issue.Index))
57+
return
6058
}
59+
60+
log.Trace("Comment created: %-v #%d[%d] Comment[%d]", ctx.Repo.Repository, issue.Index, issue.ID, comment.ID)
61+
ctx.Redirect(comment.HTMLURL())
6162
}
6263

6364
// SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist

0 commit comments

Comments
 (0)