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

panic: runtime error: invalid memory address or nil pointer dereference #38

Closed
aurelien-reeves-scalingo opened this issue Mar 27, 2023 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@aurelien-reeves-scalingo

Hi,

Looks like #20, but I was not able to identify what's going on on our side, I am not able to have a minimal reproducible example

Here's the stacktrace we are facing:

ERRO [runner] Panic: musttag: package "packagename" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference: goroutine 63072 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:24 +0x65
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func1()
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:109 +0x285
panic({0x15dc7e0, 0x212a260})
        /usr/local/go/src/runtime/panic.go:884 +0x212
go/types.(*Package).Path(...)
        /usr/local/go/src/go/types/package.go:31
github.com/junk1tm/musttag.(*checker).parseStructType(0xc0363a74f0?, {0x19bccc0?, 0xc0001cc540?}, 0x1f?)
        /home/aurelien/go/pkg/mod/github.com/junk1tm/[email protected]/musttag.go:195 +0x99
github.com/junk1tm/musttag.run.func1({0x19bc298?, 0xc0363e60c0})
        /home/aurelien/go/pkg/mod/github.com/junk1tm/[email protected]/musttag.go:150 +0x2c8
golang.org/x/tools/go/ast/inspector.(*Inspector).Preorder(0xc0217ffec0, {0xc0030799e8?, 0x1?, 0x8c878e?}, 0xc0030799f8)
        /home/aurelien/go/pkg/mod/golang.org/x/[email protected]/go/ast/inspector/inspector.go:81 +0xa8
github.com/junk1tm/musttag.run(0xc043b0a0f0, 0xc003079b28)
        /home/aurelien/go/pkg/mod/github.com/junk1tm/[email protected]/musttag.go:108 +0x15d
github.com/junk1tm/musttag.New.func1(0xc043b0a0f0?)
        /home/aurelien/go/pkg/mod/github.com/junk1tm/[email protected]/musttag.go:54 +0x125
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyze(0xc005fb6180)
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:195 +0xa22
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe.func2()
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:113 +0x1d
github.com/golangci/golangci-lint/pkg/timeutils.(*Stopwatch).TrackStage(0xc00281f4f0, {0x172f703, 0x7}, 0xc004f47f48)
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/timeutils/stopwatch.go:111 +0x4a
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*action).analyzeSafe(0xc0026da9c0?)
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_action.go:112 +0x85
github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze.func2(0xc005fb6180)
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:80 +0xb4
created by github.com/golangci/golangci-lint/pkg/golinters/goanalysis.(*loadingPackage).analyze
        /home/aurelien/go/pkg/mod/github.com/golangci/[email protected]/pkg/golinters/goanalysis/runner_loadingpackage.go:75 +0x208 
WARN [runner] Can't run linter goanalysis_metalinter: goanalysis_metalinter: musttag: package "packagename" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference 
ERRO Running error: 1 error occurred:
        * can't run linter goanalysis_metalinter: goanalysis_metalinter: musttag: package "packagename" (isInitialPkg: true, needAnalyzeSource: true): runtime error: invalid memory address or nil pointer dereference
@tmzane
Copy link
Member

tmzane commented Mar 28, 2023

Hey, thank you for the report, I'll take a look 👍

@tmzane tmzane self-assigned this Mar 28, 2023
@tmzane tmzane added the bug Something isn't working label Mar 28, 2023
@tmzane
Copy link
Member

tmzane commented Mar 28, 2023

Unfortunately, I wasn't able to reproduce the panic, but it looks like #39 will be enough to fix it.

@aurelien-reeves-scalingo could you please build musttag from the PR above and rerun it on the same codebase?

@aurelien-reeves-scalingo
Copy link
Author

I am deeply sorry but I do not reproduce the error anymore, so I cannot tell if the fix is enough or not.

I did a lot of changes in the meantime, I'll do my best to identify and revert to a reproducible state, but I cannot promise anything at the moment

@tmzane
Copy link
Member

tmzane commented Mar 30, 2023

Thank you, I appreciate your time!

Even if we won't be able to reproduce it, there was a bug indeed (it's clear from the docs the used function may return nil) and #39 is the fix.

I'll leave the issue open for now, in case you have anything to add or somebody else faces it.

@tmzane
Copy link
Member

tmzane commented Apr 21, 2023

As #39 has been merged, it looks like we're good here. Feel free to reopen the issue otherwise.

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

No branches or pull requests

2 participants