Skip to content

Update golangci-lint

Pedro Pombeiro requested to merge pedropombeiro/update-golangci-lint into main

What does this MR do?

It:

These are the new linter errors that needed fixing after the upgrade:

WARN [runner] The linter 'golint' is deprecated (since v1.41.0) due to: The repository of the linter has been archived by the owner.  Replaced by revive. 
executors/docker/internal/wait/wait_test.go:69:12: typeUnparen: could simplify (<-chan container.ContainerWaitOKBody) to <-chan container.ContainerWaitOKBody (gocritic)
                                Return((<-chan container.ContainerWaitOKBody)(bodyCh), (<-chan error)(errCh)).
                                       ^
executors/docker/internal/wait/wait_test.go:86:10: typeUnparen: could simplify (<-chan container.ContainerWaitOKBody) to <-chan container.ContainerWaitOKBody (gocritic)
                Return((<-chan container.ContainerWaitOKBody)(bodyCh), nil).
                       ^
executors/docker/internal/wait/wait_test.go:137:10: typeUnparen: could simplify (<-chan container.ContainerWaitOKBody) to <-chan container.ContainerWaitOKBody (gocritic)
                Return((<-chan container.ContainerWaitOKBody)(bodyCh), nil)
                       ^
executors/kubernetes/kubernetes_test.go:3926:12: typeUnparen: could simplify (<-chan string) to <-chan string (gocritic)
                                Return((<-chan string)(tc.lineCh), (<-chan error)(tc.errCh)).
                                       ^
network/client.go:422:2: S1017: should replace this if statement with an unconditional strings.TrimSuffix (gosimple)
        if strings.HasSuffix(url, "/ci") {
        ^
helpers/ssh/ssh_command_test.go:21:5: ineffectual assignment to err (ineffassign)
        s, err := ssh.NewStubServer(user, pass)
           ^
session/server.go:138:23: SA4023: this comparison is never true (staticcheck)
        if session == nil || session.Handler() == nil {
                             ^
session/session.go:228:19: SA4023(related information): (*gitlab.com/gitlab-org/gitlab-runner/session.Session).Handler never returns a nil interface value (staticcheck)
func (s *Session) Handler() http.Handler {
                  ^

Why was this MR needed?

So that we build everything with a newer Go version and don't stay too far behind in terms of the tooling versions we depend on.

What's the best way to test this MR?

Run make lint

What are the relevant issue numbers?

Edited by Pedro Pombeiro

Merge request reports