You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Please include support for zerolog Panic (nil pointer check) #793
I think that that was discussed somewhere else, but perhaps a list of fully-qualified identifier names of terminating functions could be added to staticcheck.conf. So that people could update the for their projects' needs instead of teaching staticcheck about all logging and utility libraries.
I don't think I want to make this configurable. This information affects how the IR gets built, and incorrect settings could lead to incorrect IR and hard to diagnose problems.
Can just add zerolog to that list I guess, but would be nice to configure this. I don't see a huge potential for failure here, as it checks functions it finds against the configuration (rather than using the config as direct input). So the worst is you end up with a fatal function that's not fatal. Some junk values is not going to cause Weird Stuff™ to happen.
It's just that I don't see how someone could accidentally get this wrong by a typo or misunderstanding. Personally I would say that adding non-exiting functions here fits in the "that's just stupid, don't do that"-category.
But no worries, it hasn't come up that often so probably not that big of a deal. Although with e.g. #1526 it might be a bit more of a deal.
It's just that I don't see how someone could accidentally get this wrong by a typo or misunderstanding. Personally I would say that adding non-exiting functions here fits in the "that's just stupid, don't do that"-category.
I'd agree with this sentiment, you can't expect a mis-configured product to work, so I'd think it would be up to the user to decide if the potential for misconfiguring this is worth using this configuration option.
Activity
dlsrb6342 commentedon Feb 11, 2022
Hi @dominikh
Is there any update on this issue?
ainar-g commentedon Feb 11, 2022
I think that that was discussed somewhere else, but perhaps a list of fully-qualified identifier names of terminating functions could be added to
staticcheck.conf. So that people could update the for their projects' needs instead of teachingstaticcheckabout all logging and utility libraries.dlsrb6342 commentedon Feb 14, 2022
I found this in docs.
go-tools/ir/exits.go
Lines 22 to 60 in 82c7dc9
And staticcheck only supports logrus. I think zerolog can be added. 8000
@ainar-g Could you give guide how to add terminating functions to configuration?
ainar-g commentedon Feb 14, 2022
@dlsrb6342, I cannot provide any guides, since the feature doesn't exist yet. My comment was merely a proposal to add it.
arp242 commentedon May 27, 2024
Prototype for adding a new
unreachablesconfig option: 5743549The value indicates if the fn.NoReturn = irAlwaysUnwinds (rather than ir.AlwaysExits).
Few bits need to be done, and should move that switch to the default config, but seems to work.
Any feedback on this approach @dominikh before I work on this further?
dominikh commentedon May 27, 2024
I don't think I want to make this configurable. This information affects how the IR gets built, and incorrect settings could lead to incorrect IR and hard to diagnose problems.
arp242 commentedon May 27, 2024
Can just add zerolog to that list I guess, but would be nice to configure this. I don't see a huge potential for failure here, as it checks functions it finds against the configuration (rather than using the config as direct input). So the worst is you end up with a fatal function that's not fatal. Some junk values is not going to cause Weird Stuff™ to happen.
dominikh commentedon May 27, 2024
Which affects all IR-based analyzes that try to reason about the control flow of code after a non-fatal fatal function gets called.
go/ir: mark zerolog functions as exit/panic
arp242 commentedon May 29, 2024
It's just that I don't see how someone could accidentally get this wrong by a typo or misunderstanding. Personally I would say that adding non-exiting functions here fits in the "that's just stupid, don't do that"-category.
But no worries, it hasn't come up that often so probably not that big of a deal. Although with e.g. #1526 it might be a bit more of a deal.
Brian-McM commentedon May 20, 2025
I'd agree with this sentiment, you can't expect a mis-configured product to work, so I'd think it would be up to the user to decide if the potential for misconfiguring this is worth using this configuration option.
eikemeier commentedon Jun 16, 2026
@arp242: How would this handle this (Go Playground)?