Skip to content

Commit

Permalink
chore: update go and golangci-lint versions (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
tessig authored Oct 30, 2024
1 parent 695dfe4 commit 82b2b74
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ jobs:
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
version: v1.54
version: v1.61
20 changes: 9 additions & 11 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ run:
concurrency: 4
timeout: 5m
tests: true
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
modules-download-mode: readonly
allow-parallel-runners: false
go: '1.21'

# output configuration options
output:
Expand All @@ -19,7 +16,8 @@ output:
# Example: "checkstyle:report.json,colored-line-number"
#
# Default: colored-line-number
format: colored-line-number
formats:
- format: colored-line-number
print-issued-lines: true
print-linter-name: true
uniq-by-line: true
Expand All @@ -32,21 +30,20 @@ linters:
- bodyclose
- containedctx
- contextcheck
- copyloopvar
- cyclop
- durationcheck
- err113
- errcheck
- errname
- errorlint
- exhaustive
- exportloopref
- forbidigo
- forcetypeassert
- gocognit
- goconst
- gocritic
- goerr113
- gofmt
- gomnd
- gomoddirectives
- gosec
- gosimple
Expand All @@ -55,6 +52,7 @@ linters:
- ineffassign
- makezero
- misspell
- mnd
- nakedret
- nestif
- nilerr
Expand Down Expand Up @@ -87,9 +85,9 @@ issues:
- path: _test\.go
linters:
- containedctx
- err113
- forcetypeassert
- goconst
- goerr113
- varnamelen
- wrapcheck
# for tests, we prioritize readability over memory optimization
Expand All @@ -101,16 +99,16 @@ issues:
- EXC0005

linters-settings:
gomnd:
ignored-functions:
- context.WithTimeout
govet:
settings:
printf:
funcs:
- (flamingo.me/flamingo/v3/framework/flamingo.Logger).Debugf
enable:
- fieldalignment
mnd:
ignored-functions:
- context.WithTimeout
nolintlint:
require-specific: true
require-explanation: true
Expand Down
8 changes: 6 additions & 2 deletions db/shutdown_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package db_test

import (
"context"
"database/sql"
"testing"

"flamingo.me/flamingo/v3/framework/flamingo"
Expand Down Expand Up @@ -41,15 +42,18 @@ func TestShutdownSubscriber_Notify(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

mockDB, mock, err := sqlmock.New()
if err != nil {
t.Fatal(err)
}
defer mockDB.Close()

defer func(mockDB *sql.DB) {
_ = mockDB.Close()
}(mockDB)

sqlxDB := sqlx.NewDb(mockDB, "sqlmock")

if tt.wantClose {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/tessig/flamingo-mysql

go 1.21
go 1.22

toolchain go1.22.3

Expand Down
4 changes: 3 additions & 1 deletion migration/application/seeder.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ func (s *Seeder) Seed() error {
err := filepath.Walk(s.seedsDirectory, func(path string, info os.FileInfo, err error) error {
if !info.IsDir() && filepath.Ext(info.Name()) == ".sql" {
logger.Info("Seed file %s ...", info.Name())

data, err := os.ReadFile(path)
if err != nil {
logger.Fatal("Problem while reading file content of %s:", info.Name())
panic(err)
}

logger.Info("Seeding file contents...")

s.db.Connection().MustExec(string(data))
logger.Info("Seeding complete...")

}

return nil
Expand Down

0 comments on commit 82b2b74

Please sign in to comment.