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

go1.18 breaks govet nilness and unusedwrite #2668

Closed
4 tasks done
nvx opened this issue Mar 21, 2022 · 5 comments
Closed
4 tasks done

go1.18 breaks govet nilness and unusedwrite #2668

nvx opened this issue Mar 21, 2022 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@nvx
Copy link

nvx commented Mar 21, 2022

Welcome

  • Yes, I'm using a binary release within 2 latest major releases. Only such installations are supported.
  • Yes, I've searched similar issues on GitHub and didn't find any.
  • Yes, I've included all information below (version, config, etc).
  • Yes, I've tried with the standalone linter if available. (https://golangci-lint.run/usage/linters/)

Description of the problem

govet nilness and unusedwrite linters break with go1.18.

Uncommenting the disable lines in the example config provided fixes the issue. These should be disabled when go: 1.18 is specified in the config file like other problematic linters.

Version of golangci-lint

$ golangci-lint --version
golangci-lint has version 1.45.0 built from 1f4c1ed9 on 2022-03-18T15:08:39Z

Configuration file

$ cat .golangci.yml
run:
  go: 1.18

linters:
  disable-all: true
  enable:
    - govet

linters-settings:
  govet:
    enable-all: true
#    disable:
#      - nilness
#      - unusedwrite

Go environment

$ go version
go version go1.18 windows/amd64

Verbose output of running

$ golangci-lint cache clean
$ golangci-lint run -v
level=info msg="[config_reader] Config search paths: [./ C:\\Users\\user\\go\\src\\example.com\\user\\foo C:\\Users\\user\\go\\src\\example.com\\~user C:\\Users\\user\\go\\src\\example.com C:\\Users\\user\\go\\src C:\\Users\\jc19324
3\\go C:\\Users\\user C:\\Users C:\\]"
level=info msg="[config_reader] Used config file .golangci.yaml"
level=info msg="[lintersdb] Active 1 linters: [govet]"
level=info msg="[loader] Go packages loading at mode 575 (deps|exports_file|name|types_sizes|compiled_files|files|imports) took 556.7883ms"
level=info msg="[runner/filename_unadjuster] Pre-built 0 adjustments in 0s"
level=info msg="[linters context/goanalysis] analyzers took 6.5542ms with top 10 stages: findcall: 1.7631ms, printf: 1.7266ms, ctrlflow: 1.1903ms, copylocks: 646.7µs, shadow: 572.8µs, reflectvaluecompare: 508.8µs, unreachable: 46.1µs, sigchanyzer: 46.1µs, bools: 17.
9µs, unusedresult: 17.9µs"
level=error msg="[runner] Panic: nilness: package \"foo\" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildssa.SSA: goroutine 526 [running]:\nruntime/debug.Stack()\n\truntime/debug/stack.go:24 +0x65\ngithub.com/gola
ngci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:101 +0x155\npanic({0x12cf460, 0xc0004f44e0})\n\truntime/panic.go:838 +0x207\ngolang.org/x/tools/go/analysis/passe
s/nilness.run(0xc0004fac30)\n\tgolang.org/x/tools@v0.1.10/go/analysis/passes/nilness/nilness.go:64 +0xad\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0004d0bd0)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_
action.go:187 +0x9c4\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_action.go:105 +0x1d\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).Trac
kStage(0xc0002119f0, {0x13e777a, 0x7}, 0xc000653f48)\n\tgithub.com/golangci/golangci-lint/pkg/timeutils/stopwatch.go:111 +0x4a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc000190d90?)\n\tgithub.com/golangci/golangci-lint/pkg/g
olinters/goanalysis/runner_action.go:104 +0x85\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0004d0bd0)\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4\ncreated by githu
b.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze\n\tgithub.com/golangci/golangci-lint/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x1eb\n"
level=warning msg="[runner] Can't run linter govet: govet: nilness: package \"foo\" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildssa.SSA"
level=info msg="[runner] processing took 0s with stages: identifier_marker: 0s, uniq_by_line: 0s, diff: 0s, max_same_issues: 0s, source_code: 0s, severity-rules: 0s, cgo: 0s, skip_files: 0s, path_prefixer: 0s, autogenerated_exclude: 0s, exclude: 0s, sort_results: 0s
, path_prettifier: 0s, skip_dirs: 0s, filename_unadjuster: 0s, max_per_file_from_linter: 0s, max_from_linter: 0s, path_shortener: 0s, exclude-rules: 0s, nolint: 0s"
level=info msg="[runner] linters took 6.1284ms with stages: govet: 5.5819ms"
level=error msg="Running error: 1 error occurred:\n\t* can't run linter govet: govet: nilness: package \"foo\" (isInitialPkg: true, needAnalyzeSource: true): interface conversion: interface {} is nil, not *buildssa.SSA\n\n"
level=info msg="Memory: 8 samples, avg is 53.1MB, max is 53.1MB"
level=info msg="Execution took 635.3789ms"

Code example or link to a public repository

package set
type Set[T comparable] map[T]struct{}
@nvx nvx added the bug Something isn't working label Mar 21, 2022
@boring-cyborg
Copy link

boring-cyborg bot commented Mar 21, 2022

Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.

@nvx
Copy link
Author

nvx commented Mar 21, 2022

Related to #2649

@ldez
Copy link
Member

ldez commented Mar 21, 2022

Hello, it's already in #2438 and #2649.

As it's not directly related to golangci-lint, I close this issue.

FYI I opened an issue on the Go repo golang/go#51038 that has been flag as a duplicate of golang/go#48525

@ldez ldez closed this as completed Mar 21, 2022
@ldez ldez added duplicate This issue or pull request already exists and removed bug Something isn't working labels Mar 21, 2022
@ldez
Copy link
Member

ldez commented Mar 21, 2022

The 2 analyzers will be inactivated with go1.18, take a look at #2669

@nvx
Copy link
Author

nvx commented Mar 21, 2022

The 2 analyzers will be inactivated with go1.18, take a look at #2669

yup sweet, that was what I was hoping for

anything beyond that is obviously out of scope of golangci-lint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants