We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b625028 commit 480aa9bCopy full SHA for 480aa9b
cmd/jwt/main.go
@@ -9,6 +9,7 @@ package main
9
10
import (
11
"encoding/json"
12
+ "errors"
13
"flag"
14
"fmt"
15
"io"
@@ -74,7 +75,7 @@ func start() error {
74
75
}
76
77
// Helper func: Read input from specified file or stdin
-func loadData(p string) ([]byte, error) {
78
+func loadData(p string) (_ []byte, retErr error) {
79
if p == "" {
80
return nil, fmt.Errorf("no path specified")
81
@@ -91,9 +92,9 @@ func loadData(p string) ([]byte, error) {
91
92
return nil, err
93
94
rdr = f
- if err := f.Close(); err != nil {
95
- return nil, err
96
- }
+ defer func() {
+ retErr = errors.Join(retErr, f.Close())
97
+ }()
98
99
return io.ReadAll(rdr)
100
0 commit comments