Open honey-yogurt opened 11 months ago
Hey, thank you for opening your first Issue ! 🙂 If you would like to contribute we have a guide for contributors.
I have updated golangci-lint to the latest version, but there are still the same errors.
golangci-lint has version v1.55.2 built with go1.20.7 from (unknown, mod sum: "h1:yllEIsSJ7MtlDBwDJ9IMBkyEUz2fYE0b5B8IUgO1oP8=") on (unknown)
@honey-yogurt, hi!
Looks like issue in gomodguard
, not in golangci-lint
.
Based on stacktrace, this line panics.
You could debug gomodguard
separately running your example. Thanks
P.S. Also I am not sure that gomodguard
supports nested modules, we need to check it.
@Antonboom thanks, I have submitted an issue on gomodguard.
I don't think there is a problem with gomodguard. golangci-lint should be run inside a module and not outside.
Gomodguard does not support nested modules at the moment. Though that may change next year. I have not tested it outside of a module, I can do that and raise an error instead of panic.
Serval projects are failded to execute golangci-lint run
.
Logs:
Panic: interfacer: package \"itemfeature\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 29347 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:108 +0x27c\npanic({0x16346c0?, 0x220b230?})\n\t/usr/local/go/src/runtime/panic.go:914 +0x21f\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func1(0xc009341040)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:61 +0x105\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func2({0x1a30fb8, 0xc0210daee0})\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:78 +0x94\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func3(0xc03a96b680)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:109 +0x112\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions(0xc0316c61a0)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:123 +0x362\nmvdan.cc/interfacer/check.(*Checker).Check(0xc014be1560)\n\t/go/pkg/mod/mvdan.cc/interfacer@v0.0.0-20180901003855-c20040233aed/check/check.go:143 +0x2d8\ngithub.com/golangci/golangci-lint/pkg/golinters.runInterfacer(0xc033c604e0)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/interfacer.go:63 +0x3f6\ngithub.com/golangci/golangci-lint/pkg/golinters.NewInterfacer.func1(0x16212a0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/interfacer.go:26 +0x29\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0066a0e90)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:190 +0xb13\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:112 +0x17\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc001cc6190, {0x17c02f6, 0xa}, 0xc002248f48)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/timeutils/stopwatch.go:111 +0x44\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:111 +0x7a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0066a0e90)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xa8\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze in goroutine 966\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x205\n
Panic: interfacer: package \"merge\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 26581 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:108 +0x27c\npanic({0x16346c0?, 0x220b230?})\n\t/usr/local/go/src/runtime/panic.go:914 +0x21f\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func1(0xc02be424e0)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:61 +0x105\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func2({0x1a30fb8, 0xc02bbd52d0})\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:78 +0x94\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func3(0xc004baa880)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:109 +0x112\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions(0xc034b15790)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:123 +0x362\nmvdan.cc/interfacer/check.(*Checker).Check(0xc027b23320)\n\t/go/pkg/mod/mvdan.cc/interfacer@v0.0.0-20180901003855-c20040233aed/check/check.go:143 +0x2d8\ngithub.com/golangci/golangci-lint/pkg/golinters.runInterfacer(0xc030da9930)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/interfacer.go:63 +0x3f6\ngithub.com/golangci/golangci-lint/pkg/golinters.NewInterfacer.func1(0x16212a0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/interfacer.go:26 +0x29\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc006671280)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:190 +0xb13\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:112 +0x17\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc0020afc20, {0x17c02f6, 0xa}, 0xc016f96748)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/timeutils/stopwatch.go:111 +0x44\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0x0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:111 +0x7a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc006671280)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xa8\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze in goroutine 1071\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x205\n
Panic: unparam: package \"mock_cache\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 10433 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:108 +0x27c\npanic({0x16346c0?, 0x220b230?})\n\t/usr/local/go/src/runtime/panic.go:914 +0x21f\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func1(0xc01490c820)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:61 +0x105\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func2({0x1a30fb8, 0xc008717370})\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:78 +0x94\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions(0xc0221a40d0)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:131 +0x2c8\nmvdan.cc/unparam/check.(*Checker).Check(0xc011f45720)\n\t/go/pkg/mod/mvdan.cc/unparam@v0.0.0-20240104100049-c549a3470d14/check/check.go:230 +0x2b0\ngithub.com/golangci/golangci-lint/pkg/golinters.runUnparam(0xc00d8cdba0, 0xc000428c38)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/unparam.go:75 +0x1c7\ngithub.com/golangci/golangci-lint/pkg/golinters.NewUnparam.func1(0x16212a0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/unparam.go:28 +0x2d\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc004fbf430)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:190 +0xb13\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:112 +0x17\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc001ed9770, {0x17989bf, 0x7}, 0xc00267b748)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/timeutils/stopwatch.go:111 +0x44\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc001d09380?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:111 +0x7a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc004fbf430)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xa8\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze in goroutine 954\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x205\n
Panic: interfacer: package \"store_feature\" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 15902 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:108 +0x27c\npanic({0x16346c0?, 0x220b230?})\n\t/usr/local/go/src/runtime/panic.go:914 +0x21f\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func1(0xc00dedaea0)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:61 +0x105\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions.func2({0x1a30fb8, 0xc00b227700})\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:78 +0x94\ngolang.org/x/tools/go/ssa/ssautil.AllFunctions(0xc008eb5860)\n\t/go/pkg/mod/golang.org/x/tools@v0.18.0/go/ssa/ssautil/visit.go:131 +0x2c8\nmvdan.cc/interfacer/check.(*Checker).Check(0xc0182c2180)\n\t/go/pkg/mod/mvdan.cc/interfacer@v0.0.0-20180901003855-c20040233aed/check/check.go:143 +0x2d8\ngithub.com/golangci/golangci-lint/pkg/golinters.runInterfacer(0xc0182bd790)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/interfacer.go:63 +0x3f6\ngithub.com/golangci/golangci-lint/pkg/golinters.NewInterfacer.func1(0x16212a0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/interfacer.go:26 +0x29\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc0056d92d0)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:190 +0xb13\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:112 +0x17\ngithub.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc002676550, {0x17c02f6, 0xa}, 0xc003463748)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/timeutils/stopwatch.go:111 +0x44\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0022067e0?)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_action.go:111 +0x7a\ngithub.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc0056d92d0)\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xa8\ncreated by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze in goroutine 922\n\t/go/pkg/mod/github.com/golangci/golangci-lint@v1.56.2/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x205\n
@chenyanchen can you open a new issue?
Welcome
Description of the problem
This is my first time using golangci-lint, adding pre-commit to an existing project. My go.mod file is not in the root directory of the project. I used the pre-commit-hook project to apply golangci-lint. After renaming the directory where go.mod is located, I encountered a problem with the title. This is my project structure:
Version of golangci-lint
Configuration
Go environment
Verbose output of running
A minimal reproducible example or link to a public repository
Validation