fix: avoid shadowed vars for lint
Some checks failed
ci / test (push) Has been cancelled

This commit is contained in:
Peter Steinberger 2025-12-17 22:16:18 +01:00
parent 2ca93e9a9f
commit 631f442798
2 changed files with 11 additions and 11 deletions

View File

@ -74,19 +74,19 @@ func TestExecute_GmailAttachment_OutPath_JSON(t *testing.T) {
run := func() (string, map[string]any) {
out := captureStdout(t, func() {
_ = captureStderr(t, func() {
if err := Execute([]string{
if execErr := Execute([]string{
"--output", "json",
"--account", "a@b.com",
"gmail", "attachment", "m1", "a1",
"--out", outPath,
}); err != nil {
t.Fatalf("Execute: %v", err)
}); execErr != nil {
t.Fatalf("Execute: %v", execErr)
}
})
})
var parsed map[string]any
if err := json.Unmarshal([]byte(out), &parsed); err != nil {
t.Fatalf("json parse: %v\nout=%q", err, out)
if unmarshalErr := json.Unmarshal([]byte(out), &parsed); unmarshalErr != nil {
t.Fatalf("json parse: %v\nout=%q", unmarshalErr, out)
}
return out, parsed
}

View File

@ -45,13 +45,13 @@ func newGmailAttachmentCmd(flags *rootFlags) *cobra.Command {
}
if strings.TrimSpace(outPath) == "" {
dir, err := config.EnsureGmailAttachmentsDir()
if err != nil {
return err
dir, dirErr := config.EnsureGmailAttachmentsDir()
if dirErr != nil {
return dirErr
}
path, cached, err := downloadAttachment(cmd, svc, messageID, info, dir)
if err != nil {
return err
path, cached, dlErr := downloadAttachment(cmd, svc, messageID, info, dir)
if dlErr != nil {
return dlErr
}
if outfmt.IsJSON(cmd.Context()) {
return outfmt.WriteJSON(os.Stdout, map[string]any{"path": path, "cached": cached})