Quellcode durchsuchen

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>
tags/v1.13.0-dev
zeripath vor 4 Jahren
Ursprung
Commit
bf847b9397
Es ist kein Account mit der E-Mail-Adresse des Committers verbunden

+ 2
- 2
Makefile Datei anzeigen

golangci-lint: golangci-lint:
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \ @hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
export BINARY="golangci-lint"; \ 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 fi
golangci-lint run --timeout 5m
env GO111MODULE=on golangci-lint run --timeout 5m

+ 3
- 3
models/error.go Datei anzeigen

} }


func (err ErrUserNotAllowedCreateOrg) Error() string { 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. // ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
} }


func (err ErrAccessTokenEmpty) Error() string { func (err ErrAccessTokenEmpty) Error() string {
return fmt.Sprintf("access token is empty")
return "access token is empty"
} }


// ________ .__ __ .__ // ________ .__ __ .__
} }


func (err ErrSHAOrCommitIDNotProvided) Error() string { 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"
} }


// __ __ ___. .__ __ // __ __ ___. .__ __

+ 1
- 1
models/notification.go Datei anzeigen



// Without returns the notification list without the failures // Without returns the notification list without the failures
func (nl NotificationList) Without(failures []int) NotificationList { func (nl NotificationList) Without(failures []int) NotificationList {
if failures == nil || len(failures) == 0 {
if len(failures) == 0 {
return nl return nl
} }
remaining := make([]*Notification, 0, len(nl)) remaining := make([]*Notification, 0, len(nl))

+ 1
- 1
modules/private/key.go Datei anzeigen

// and returns public key found. // and returns public key found.
func AuthorizedPublicKeyByContent(content string) (string, error) { func AuthorizedPublicKeyByContent(content string) (string, error) {
// Ask for running deliver hook and test pull request tasks. // 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 := newInternalRequest(reqURL, "POST")
req.Param("content", content) req.Param("content", content)
resp, err := req.Response() resp, err := req.Response()

+ 3
- 3
modules/private/manager.go Datei anzeigen



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


req := newInternalRequest(reqURL, "POST") req := newInternalRequest(reqURL, "POST")
resp, err := req.Response() resp, err := req.Response()


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


req := newInternalRequest(reqURL, "POST") req := newInternalRequest(reqURL, "POST")
resp, err := req.Response() resp, err := req.Response()


// FlushQueues calls the internal flush-queues function // FlushQueues calls the internal flush-queues function
func FlushQueues(timeout time.Duration, nonBlocking bool) (int, string) { 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") req := newInternalRequest(reqURL, "POST")
if timeout > 0 { if timeout > 0 {

+ 0
- 1
routers/repo/compare.go Datei anzeigen

beforeCommitID := ctx.Data["BeforeCommitID"].(string) beforeCommitID := ctx.Data["BeforeCommitID"].(string)
afterCommitID := ctx.Data["AfterCommitID"].(string) afterCommitID := ctx.Data["AfterCommitID"].(string)



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


ctx.Data["IsRepoToolbarCommits"] = true ctx.Data["IsRepoToolbarCommits"] = true

+ 6
- 5
routers/repo/pull_review.go Datei anzeigen

return 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)) 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 // SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist

Laden…
Abbrechen
Speichern