From dc9185d389e7905f5882a0355434c64977346305 Mon Sep 17 00:00:00 2001 From: Travis Newhouse <12889757+travisnewhouse@users.noreply.github.com> Date: Sat, 19 Jul 2025 14:46:52 -0700 Subject: [PATCH] Fix file reading in cmd/jwt Inside of `loadData()`, the `os.File` was being closed before its contents were read by `io.ReadAll()`. Defer the close operation until the end of the function. --- cmd/jwt/main.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cmd/jwt/main.go b/cmd/jwt/main.go index 663e7e8b..30726e73 100644 --- a/cmd/jwt/main.go +++ b/cmd/jwt/main.go @@ -91,9 +91,7 @@ func loadData(p string) ([]byte, error) { return nil, err } rdr = f - if err := f.Close(); err != nil { - return nil, err - } + defer f.Close() } return io.ReadAll(rdr) }