Closed je4 closed 1 week ago
Hey @je4 thanks for this detailed report, removing panics from these init functions seems on the face of it a good idea. I'll check if there are any downstream consequences of doing that
Hi @je4 I've made changes to remove panics altogether and reduce use of init functions. This should be fixed in next release, out in about a week. I've you'd like to test, there's a release candidate here: https://github.com/richardlehane/siegfried/releases/tag/v1.11.1-rc4
We are using siegfried as library in other go projects. Since a recent update there is an error on miminalistic docker files (no home directory etc.) on kubernetes.
2024/03/28 10:25:26 stat /dev/null/siegfried: not a directory
Last version which was tested ok is v1.10.1.
From our point of view, this error occurs within an init() function. We think, it could be https://github.com/richardlehane/siegfried/blob/aa72ecceaa3e302add1d89cd1767e45d3a20255a/pkg/config/default.go#L40
If homedirectory points to /dev/null, this line tries to
os.Stat("/dev/null/siegfried")
. After that, the error is not known andlog.Fatal(err)
in https://github.com/richardlehane/siegfried/blob/aa72ecceaa3e302add1d89cd1767e45d3a20255a/pkg/config/default.go#L44 happens.This error occurs even if we do not use any functionality from siegfried. Using a library which uses siegfried is enough.
Is there a way to make sure, that
init()
function cannot result in afatal()
orpanic()
?It's quite hard to debug the minimalistic docker image, since it has no delve on it.