update dependencies (#46)

* update dependencies
This commit is contained in:
T.v.Dein
2025-06-10 16:12:54 +02:00
committed by GitHub
parent f22719a92b
commit aad9b31169
15 changed files with 154 additions and 66 deletions

View File

@@ -156,7 +156,7 @@ func Del(conf *cfg.Config) *cobra.Command {
Long: `Delete key and value matching key`,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("No key specified")
return errors.New("no key specified")
}
// errors at this stage do not cause the usage to be shown

View File

@@ -21,6 +21,7 @@ import (
"errors"
"fmt"
"io"
"log"
"os"
"os/exec"
@@ -285,7 +286,11 @@ func editContent(editor string, content string) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to create templ file: %w", err)
}
defer os.Remove(tmp.Name())
defer func() {
if err := os.Remove(tmp.Name()); err != nil {
log.Fatal(err)
}
}()
// put the content into a tmp file
_, err = tmp.WriteString(content)
@@ -310,7 +315,11 @@ func editContent(editor string, content string) (string, error) {
if err != nil {
return "", fmt.Errorf("failed to open temp file: %w", err)
}
defer modified.Close()
defer func() {
if err := modified.Close(); err != nil {
log.Fatal(err)
}
}()
newcontent, err := io.ReadAll(modified)
if err != nil {