Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func main() {
- clipboardContent, err := clipboard.ReadAll()
- if err != nil {
- fmt.Println("An error occurred while reading input. Please try again", err)
- return
- }
- err = getLinks(clipboardContent)
- if err != nil {
- fmt.Println("\n❌", err.Error(), "Check the search URL and retry.")
- return
- }
- }
- Refactor for testability, error handling
- func run() error {
- searchURL, err := clipboard.ReadAll()
- if err != nil {
- return fmt.Errorf("Error reading clipboard: %w", err)
- }
- err = getLinks(searchURL)
- if err != nil {
- return fmt.Errorf("Error getting links: %w", err)
- }
- return nil
- }
- func main() {
- err := run()
- if err != nil {
- fmt.Println("An error occurred:", err)
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement