From 0b5787ea9fc970833d910efcf8e55983c29f86dd Mon Sep 17 00:00:00 2001 From: tobifroe Date: Sun, 27 Oct 2024 10:26:07 +0100 Subject: [PATCH] fix: various code quality issues --- Dockerfile | 4 ++-- cmd/root.go | 4 ---- util/util_test.go | 8 +++++--- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4154369..936f7f0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ FROM golang:alpine -RUN apk add make +RUN apk --no-cache add make WORKDIR /app @@ -8,4 +8,4 @@ COPY . /app RUN make build-docker -ENTRYPOINT ["./starscraper"] \ No newline at end of file +ENTRYPOINT ["./starscraper"] diff --git a/cmd/root.go b/cmd/root.go index f3ee594..07e192b 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -18,7 +18,3 @@ func Execute() { os.Exit(1) } } - -func init() { - -} diff --git a/util/util_test.go b/util/util_test.go index d90e874..54030bd 100644 --- a/util/util_test.go +++ b/util/util_test.go @@ -12,6 +12,8 @@ import ( "github.com/tobifroe/starscraper/types" ) +const outfile = "output.csv" + func TestWriteToCSV(t *testing.T) { // Mock data for testing users := []types.User{ @@ -20,10 +22,10 @@ func TestWriteToCSV(t *testing.T) { } // Execute the function - WriteToCSV(users, "output.csv") + WriteToCSV(users, outfile) // Read the written file - file, err := os.Open("output.csv") + file, err := os.Open(outfile) if err != nil { t.Fatal(err) } @@ -80,7 +82,7 @@ func TestMain(m *testing.M) { exitVal := m.Run() // Clean up after tests - err := os.Remove("output.csv") + err := os.Remove(outfile) if err != nil { panic(err) }