Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.54.0 warns about using plugins using the old API #4001

Closed
5 tasks done
pohly opened this issue Aug 10, 2023 · 8 comments · Fixed by #4002
Closed
5 tasks done

v1.54.0 warns about using plugins using the old API #4001

pohly opened this issue Aug 10, 2023 · 8 comments · Fixed by #4002
Assignees
Labels
bug Something isn't working linter: custom About custom/private linters

Comments

@pohly
Copy link
Contributor

pohly commented Aug 10, 2023

Welcome

Description of the problem

In Kubernetes we need to update golangci-lint to 1.54.0 to support Go 1.21 and also need to backport that update to older release branches, ideally without any other unnecessary changes. Older branches have to be updated to stay on a supported Go release. In particular we would prefer to not update the version of logcheck, the custom plugin that Kubernetes is using.

This currently leads to this warning on every invocation, which happens multiple times for different modules:

 ERROR: level=warning msg="plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: https://golangci-lint.run/contributing/new-linters/#create-a-plugin"

It would be nice to give users a bit more time to upgrade plugins before warning about them. Can this warning be removed from v1.54.x and be enabled again in 1.55.x?

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version v1.54.0 built with go1.21.0 from (unknown, mod sum: "h1:sWD8sCmlWRZYj7I0VZLwX7uYfjIcIUHq8rSO4IJtzdw=") on (unknown)

Configuration

https://github.com/kubernetes/kubernetes/blob/18c3c7efb3bcccd84cccc7dacc01f0a7427b8eb9/hack/golangci.yaml#L1-L60

Go environment

$ go version && go env
go version go1.21.0 linux/amd64
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/pohly/.cache/go-build'
GOENV='/home/pohly/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/nvme/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/nvme/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/nvme/gopath/src/k8s.io/kubernetes/_output/local/.gimme/versions/go1.21.0.linux.amd64'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/nvme/gopath/src/k8s.io/kubernetes/_output/local/.gimme/versions/go1.21.0.linux.amd64/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.0'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/nvme/gopath/src/k8s.io/kubernetes/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1184767112=/tmp/go-build -gno-record-gcc-switches'

Verbose output of running

$ kubernetes$ hack/verify-golangci-lint.sh ./pkg/routes
go version go1.21.0 linux/amd64
installing golangci-lint and logcheck plugin from hack/tools into /nvme/gopath/src/k8s.io/kubernetes/_output/local/bin
running env LOGCHECK_CONFIG=/nvme/gopath/src/k8s.io/kubernetes/hack/logcheck.conf /nvme/gopath/src/k8s.io/kubernetes/_output/local/bin/golangci-lint run --config=/nvme/gopath/src/k8s.io/kubernetes/hack/golangci.yaml --color=always ./pkg/routes
ERROR: level=warning msg="plugin: 'AnalyzerPlugin' plugins are deprecated, please use the new plugin signature: https://golangci-lint.run/contributing/new-linters/#create-a-plugin"
Congratulations! All files are passing lint :-)

Code example or link to a public repository

https://github.com/kubernetes/kubernetes/tree/master

Validation

  • Yes, I've included all information above (version, config, etc.).
@pohly pohly added the bug Something isn't working label Aug 10, 2023
@ldez ldez self-assigned this Aug 10, 2023
@ldez
Copy link
Member

ldez commented Aug 10, 2023

It would be nice to give users a bit more time to upgrade plugins before warning about them.

If we don't have a log the users will not be informed, I know that only a few people read the changelog.

🤔 I don't know what to answer.

@ldez
Copy link
Member

ldez commented Aug 10, 2023

Is it a blocker?

@ldez
Copy link
Member

ldez commented Aug 10, 2023

anyway, we can wait until the next minor to display the warning. I will create a PR.

@bombsimon
Copy link
Member

I agree with #4001 (comment). If we don't show the log over multiple versions, how should the user be informed so they get as much time as possible to migrate? Isn't removing the log just pushing the problem forward?

@ldez
Copy link
Member

ldez commented Aug 10, 2023

We can see the new contract as "experimental" and hope that users will read the changelog.
I'm not going to lie: I'm not really convinced by my own argument.

I don't understand why this log is a problem.

@pohly
Copy link
Contributor Author

pohly commented Aug 11, 2023

I don't understand why this log is a problem.

Every Kubernetes developer who runs linting locally will see the warning. Most won't know what it is about. Some will spend (and thus waste) time on investigating. Some may file bugs about it, which then need to be triaged.

The effect can be seen in https://prow.k8s.io/view/gs/kubernetes-jenkins/pr-logs/pull/119860/pull-kubernetes-verify/1689711883013066752: because the lines contain "ERROR", it even gets highlighted in the summary of the build log.

This is not a blocker, just a nuisance.

@pohly
Copy link
Contributor Author

pohly commented Aug 11, 2023

A command line flag to disable that warning also works, but that itself then needs to be maintained.

@pohly
Copy link
Contributor Author

pohly commented Aug 11, 2023

Perhaps some env variable?

GOLANGCI_LINT_I_KNOW_ABOUT_THE_PLUGIN_API_DONT_WARN_ME=1? 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linter: custom About custom/private linters
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants