-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support of generics #2649
Comments
I think we can pin this issue and lists all issues related to Go 1.18 support. |
If someone want to help, you can contribute to solving this issue golang/go#48525 |
In our project after go version update to 1.18, the CI detected a lot of "github.com/onsi/ginkgo" imported but not used (typecheck)
. "github.com/onsi/ginkgo" undeclared name: `Describe` (typecheck)
var _ = Describe("Authenticator Unit Tests", func() {
^ |
This reverts commit c8e93d2. golangci-lint does not support 1.18 yet (golangci/golangci-lint#2649), postpone the upgrade.
This reverts commit ebb720d. golangci-lint does not support 1.18 yet (golangci/golangci-lint#2649), postpone the upgrade.
thats strange, I'm able to build golangci-lint with go1.18 without any issues however, I'm unable to run previously installed (before update to go 1.18) rpm 🤔 $ /usr/local/bin/golangci-lint run ./...
panic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt
goroutine 1 [running]:
github.com/go-critic/go-critic/checkers.init.22()
github.com/go-critic/go-critic@v0.6.2/checkers/embedded_rules.go:46 +0x4b4 after building linter by myself:
|
Message for everyoneI'm working to find quick solutions (proposals and implementations), I will try to send a status update tomorrow. I do my best, stay tuned. |
Remove the "deadcode", "structcheck", and "varcheck" linters, as they are deprecated: WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. And ignore gosec G113, which only affects gp < 1.16.14. and go < 1.17.7 opts/opts.go:398:13: G113: Potential uncontrolled memory consumption in Rat.SetString (CVE-2022-23772) (gosec) cpu, ok := new(big.Rat).SetString(value) ^ Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit 0dd2c18) Signed-off-by: Cory Snider <csnider@mirantis.com>
Remove nolint-comments that weren't hit by linters, and remove the "structcheck" and "varcheck" linters, as they have been deprecated: WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. Signed-off-by: Sebastiaan van Stijn <github@gone.nl> (cherry picked from commit f9c80be) Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
All the linters are now fixed 🎉, we create a release soon ⏲️. |
Switch to run golangci-lint using `make check` in CI for now, using the golangci-lint GH action with Go 1.18 is not yet fully supported, see golangci/golangci-lint#2649 This approach was suggested by Robin. Signed-off-by: Tobias Klauser <tobias@cilium.io>
I'm using version 1.52.2 ( $ golangci-lint run --no-config --disable-all -E structcheck
WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
WARN [linters_context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the https://github.com/golangci/golangci-lint/issues/2649.
$ Is there a way to analyze and fix maligned structs using golangci-lint? |
govet's fieldalignment analyzer should do this per the docs: https://golangci-lint.run/usage/linters/ |
Issue #2649 is closed now. Suppose it works without limitations now.
Switch to run golangci-lint using `make check` in CI for now, using the golangci-lint GH action with Go 1.18 is not yet fully supported, see golangci/golangci-lint#2649 This approach was suggested by Robin. Signed-off-by: Tobias Klauser <tobias@cilium.io>
Remove nolint-comments that weren't hit by linters, and remove the "structcheck" and "varcheck" linters, as they have been deprecated: WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
- Resolves sourcenetwork#720 - Description > Bumps Go versions of GitHub Action environment setups. > Bumps Docker image Go version. > Bumps and resolves Linter issues. > Bumps and Updates `go.mod`. - Limitation > A sub-linter was disabled because it lacked support with `v1.18` of Go. Can be easily turned back on if they bump up their support (golangci/golangci-lint#2649). > Despite us bumping to 1.18, we internally ban the use of generics until our benchmarks are fixed.
There's a bunch of deprecated linters that don't work anymore, so let's remove them: ``` WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. ``` Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com>
* go1.20.14 Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * more go-version: updates Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * make proto w/go1.20 Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Fix the golangci-lint config (vitessio#11812) There's a bunch of deprecated linters that don't work anymore, so let's remove them: ``` WARN [runner] The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. ``` Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> * update golangci-lint to 1.50.1 (vitessio#11873) Signed-off-by: Andres Taylor <andres@planetscale.com> Signed-off-by: Andres Taylor <andres@planetscale.com> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add timeout to golangci-lint and bump its version (vitessio#12852) (vitessio#12853) Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Upgrade `release-16.0` to `go1.20.1` (vitessio#12398) * Upgrade release-16.0 to go1.19.6 Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * upgrade to 1.20.1 Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * bump the golangci-lint version Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Apply linter suggestions Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Apply linter suggestions Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * fix TestTLSClientVerifyIdentity Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Switch to using new Go 1.19 CRL parser (vitessio#12315) `x509.ParseCRL` is deprecated, we should use `x509.ParseRevocationList` instead which is new in Go 1.19. Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Skip TestFuzz for now Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> --------- Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com> * Remove recent golangci-lint version bump (vitessio#12909) Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> * Fix conflict resolution Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * make ensure_bootstrap_version Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * hardcode previous release Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> * Add comment for hardcoded previous release Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> --------- Signed-off-by: Tim Vaillancourt <tim@timvaillancourt.com> Signed-off-by: Dirkjan Bussink <d.bussink@gmail.com> Signed-off-by: Andres Taylor <andres@planetscale.com> Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr> Co-authored-by: Dirkjan Bussink <d.bussink@gmail.com> Co-authored-by: Andres Taylor <andres@planetscale.com> Co-authored-by: Florent Poinsard <35779988+frouioui@users.noreply.github.com>
Remove nolint-comments that weren't hit by linters, and remove the "structcheck" and "varcheck" linters, as they have been deprecated: WARN [runner] The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [runner] The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused. WARN [linters context] structcheck is disabled because of generics. You can track the evolution of the generics support by following the golangci/golangci-lint#2649. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Since the version v1.45.0 golangci-lint supports go1.18.
But some linters don't work with generics, golangci-lint disable those linters automatically with go1.18.
Since v1.45.1, golangci-lint can detect the Go version used by a project.
To get the Go version golangci-lint will use, in order:
--go=1.18
go.mod
, ex;GOVERSION
Notes:
externalErrorReassign
) don't work with generics and must be disabled by handThe keyword
any
works well and produces no error (it's expected because it's just a type alias)The problem with SSA is now fixed but some linters need to update their code base to handle generics.
About the linters:
go-critic
, there is an existing issue Support generics for Go 1.18 go-critic/go-critic#1193Linter issues: (checked if the problems are solved)
struccheck: DeprecatedThe binary compiled with go1.17 doesn't work when running on go1.18:
Compatibility table
🟢️: means that the linter seems to work, but it's not 100% sure, it needs to be tested on more go1.18 code.
🟠: means that the linter works partially.
🔴: means that the linter panic.
The current state:
golangci-lint is a free and open-source project, built by people in their free time.
Also, the linter authors are an important part of golangci-lint.
If you use and appreciate golangci-lint please think to support us (golangci-lint maintainers and linters authors). ❤️
The text was updated successfully, but these errors were encountered: