-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Use fs.FS
when explicitly given
#5312
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm !
minor update
- removed gologger debug statements ( in cli
-debug
flag enables debug statements and this flag is usually used to debug template data and not nuclei engine internals )
we are thinking of adding log/slog support soon that will allow selective filtering of different type of logs via enum/custom handler
templateFs was something i was experimenting to primarily load template directory like a virtual file system and abstract various sources via https://github.com/hairyhenderson/go-fsimpl , but it never took off because of glob or some other issue, but anyway thanks for completing the support for fs.Fs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm - nice one!
Proposed changes
This updates
DiskCatalog
to usefs.FS
when explicitly given by a user viaNewFSCatalog
.The existing code half-used
fs.FS
, but there are a lot of issues with the existing implementation and what needs to be done. After doing a whole lot of testing (and concerns with golang/go#44279), I believe that the best possible implementation is a 2-track one: we support legacyos
operations by default, but if someone gives us anfs.FS
instance, then we'll use that exactly as they intended it.Long-term, I hope that the
fs.FS
semantics are fixed by Go (or at least that a meaningful package gets built that provides full backward compatibility with theos
operations).In my particular case, I have two use cases that both work with these changes:
NewCatalog
.NewFSCatalog
with github.com/quay/claircore/pkg/tarfs to provide thefs.FS
interface.Checklist