From aa1c1aab021e35883a7b749144db145d6d2022b2 Mon Sep 17 00:00:00 2001 From: daniel <40469266+daniel-burghardt@users.noreply.github.com> Date: Mon, 6 May 2024 13:27:22 -0300 Subject: [PATCH] fix: linter --- cmd/root.go | 7 +++++-- internal/serve/errors_test.go | 6 +++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 4644db1..7a10ffc 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -13,7 +13,10 @@ var rootCmd = &cobra.Command{ Use: "wallet-backend", Short: "Wallet Backend Server", Run: func(cmd *cobra.Command, args []string) { - cmd.Help() + err := cmd.Help() + if err != nil { + log.Fatalf("Error calling help command: %s", err.Error()) + } }, } @@ -22,7 +25,7 @@ var rootCmd = &cobra.Command{ func Execute() { err := rootCmd.Execute() if err != nil { - log.Fatal(err) + log.Fatalf("Error executing root command: %s", err.Error()) } } diff --git a/internal/serve/errors_test.go b/internal/serve/errors_test.go index ebec5d3..ea77406 100644 --- a/internal/serve/errors_test.go +++ b/internal/serve/errors_test.go @@ -2,7 +2,7 @@ package serve import ( "fmt" - "io/ioutil" + "io" "net/http" "net/http/httptest" "testing" @@ -36,7 +36,7 @@ func TestErrorResponseRender(t *testing.T) { tc.in.Render(w) resp := w.Result() assert.Equal(t, tc.want.Status, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) require.NoError(t, err) assert.JSONEq(t, fmt.Sprintf(`{"error":%q}`, tc.want.Error), string(body)) }) @@ -69,7 +69,7 @@ func TestErrorHandler(t *testing.T) { tc.in.ServeHTTP(w, r) resp := w.Result() assert.Equal(t, tc.want.Status, resp.StatusCode) - body, err := ioutil.ReadAll(resp.Body) + body, err := io.ReadAll(resp.Body) require.NoError(t, err) assert.JSONEq(t, fmt.Sprintf(`{"error":%q}`, tc.want.Error), string(body)) })