From 08d6c83fd4276570b64a5c4e761e8dbf79dd179a Mon Sep 17 00:00:00 2001 From: Hayden <64056131+hay-kot@users.noreply.github.com> Date: Sat, 3 Sep 2022 01:24:28 -0800 Subject: [PATCH] update CI --- .github/workflows/go.yaml | 9 +++++++++ backend/app/api/main.go | 7 ++++++- backend/internal/config/conf.go | 3 +-- backend/pkgs/mailer/mailer_test.go | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/go.yaml b/.github/workflows/go.yaml index 5138835..c996e9a 100644 --- a/.github/workflows/go.yaml +++ b/.github/workflows/go.yaml @@ -26,6 +26,15 @@ jobs: - name: Install Task uses: arduino/setup-task@v1 + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + # Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version + version: latest + + # Optional: working directory, useful for monorepos + working-directory: backend + - name: Build API run: task api:build diff --git a/backend/app/api/main.go b/backend/app/api/main.go index 29f0c22..838b648 100644 --- a/backend/app/api/main.go +++ b/backend/app/api/main.go @@ -108,7 +108,12 @@ func run(cfg *config.Config) error { // Start Reoccurring Tasks go app.StartReoccurringTasks(time.Duration(24)*time.Hour, func() { - app.repos.AuthTokens.PurgeExpiredTokens(context.Background()) + _, err := app.repos.AuthTokens.PurgeExpiredTokens(context.Background()) + if err != nil { + app.logger.Error(err, logger.Props{ + "details": "failed to purge expired tokens", + }) + } }) return app.server.Start(routes) diff --git a/backend/internal/config/conf.go b/backend/internal/config/conf.go index cf90938..d072795 100644 --- a/backend/internal/config/conf.go +++ b/backend/internal/config/conf.go @@ -4,7 +4,6 @@ import ( "encoding/json" "errors" "fmt" - "io/ioutil" "github.com/ardanlabs/conf/v2" "github.com/ardanlabs/conf/v2/yaml" @@ -48,7 +47,7 @@ func NewConfig(file string) (*Config, error) { if _, err := os.Stat(file); errors.Is(err, os.ErrNotExist) { return conf.Parse(prefix, &cfg) } else { - yamlData, err := ioutil.ReadFile(file) + yamlData, err := os.ReadFile(file) if err != nil { return "", err } diff --git a/backend/pkgs/mailer/mailer_test.go b/backend/pkgs/mailer/mailer_test.go index f1b71db..87a0b60 100644 --- a/backend/pkgs/mailer/mailer_test.go +++ b/backend/pkgs/mailer/mailer_test.go @@ -2,7 +2,7 @@ package mailer import ( "encoding/json" - "io/ioutil" + "os" "testing" "github.com/stretchr/testify/assert" @@ -14,7 +14,7 @@ const ( func GetTestMailer() (*Mailer, error) { // Read JSON File - bytes, err := ioutil.ReadFile(TestMailerConfig) + bytes, err := os.ReadFile(TestMailerConfig) mailer := &Mailer{}