-
Notifications
You must be signed in to change notification settings - Fork 666
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
Update main.go #914
base: dev
Are you sure you want to change the base?
Update main.go #914
Conversation
geeknik
commented
Jun 3, 2024
- Error Handling: Centralized error handling with the handleError function to reduce code repetition.
- Function Decomposition: Split the main function and readFlags function into smaller functions for better readability and maintainability.
- Comments: Added comments to describe the purpose of functions and key sections of the code.
- Concurrency Handling: Improved handling of signals for a graceful shutdown.
1. Error Handling: Centralized error handling with the handleError function to reduce code repetition. 2. Function Decomposition: Split the main function and readFlags function into smaller functions for better readability and maintainability. 3. Comments: Added comments to describe the purpose of functions and key sections of the code. 4. Concurrency Handling: Improved handling of signals for a graceful shutdown.
Great, thanks so much for your contribution @geeknik ! |
// on successful execution: | ||
|
||
// deduplicate the lines in each file in the store-field-dir | ||
//use options.StoreFieldDir once https://github.com/projectdiscovery/katana/pull/877 is merged |
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.
we should either use options.StoreFieldDir
or add back this comment
root := filepath.Join(homedir, ".config", "katana") | ||
filter := fileutil.FileFilters{ | ||
OlderThan: 24 * time.Hour * 10, // cleanup on the 10th day | ||
Prefix: "resume-", | ||
} | ||
_ = fileutil.DeleteFilesOlderThan(root, filter) | ||
} | ||
|
||
func handleError(message string, err error) { |
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.
Since this is going to fail, we should be more explicit about it. Something like failWithError
or similar name would be great