Simplify error handling syntax

This commit is contained in:
2026-01-08 18:50:10 -05:00
parent d54b59030e
commit d21de424cb
18 changed files with 63 additions and 114 deletions
+1 -2
View File
@@ -12,8 +12,7 @@ import (
// CopyString copies a string to the clipboard.
func CopyString(clearClipboardAutomatically bool, copySubject string) error {
cmd := exec.Command("powershell.exe", "-c", fmt.Sprintf("echo '%s' | Set-Clipboard", strings.ReplaceAll(copySubject, "'", "''")))
err := cmd.Run()
if err != nil {
if err := cmd.Run(); err != nil {
return errors.New("unable to copy to clipboard: " + err.Error())
}
if clearClipboardAutomatically {