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

Update main.go #914

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open

Update main.go #914

wants to merge 2 commits into from

Conversation

geeknik
Copy link
Contributor

@geeknik geeknik commented Jun 3, 2024

  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.

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.
@GeorginaReeder
Copy link

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
Copy link
Member

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) {
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants