diff --git a/.github/workflows/ci-workflow.yml b/.github/workflows/ci-workflow.yml index f87e058..ab5f87e 100644 --- a/.github/workflows/ci-workflow.yml +++ b/.github/workflows/ci-workflow.yml @@ -12,9 +12,9 @@ jobs: go-version: 1.22 - uses: actions/checkout@v3 - name: golangci-lint - uses: golangci/golangci-lint-action@v3 + uses: golangci/golangci-lint-action@v4 with: - version: v1.52.2 + version: v1.56.2 args: --verbose test: diff --git a/.golangci.yml b/.golangci.yml index 267ed5d..e8ea070 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -63,3 +63,4 @@ linters: run: issues-exit-code: 1 + timeout: "5m" diff --git a/.vscode/settings.json b/.vscode/settings.json index 32a320e..5f4b979 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -5,6 +5,7 @@ ], "cSpell.words": [ "bodyclose", + "cobrass", "cubiest", "deadcode", "depguard", @@ -20,6 +21,7 @@ "gocyclo", "gofmt", "goimports", + "gomega", "gomnd", "gosec", "gosimple", @@ -34,6 +36,7 @@ "nakedret", "nolint", "nolintlint", + "onsi", "pixa", "prealloc", "repotoken", @@ -41,6 +44,7 @@ "sidewalk", "skeletor", "smaug", + "snivilised", "staticcheck", "structcheck", "stylecheck", diff --git a/src/app/command/bootstrap.go b/src/app/command/bootstrap.go index 4cd877e..ee9e330 100644 --- a/src/app/command/bootstrap.go +++ b/src/app/command/bootstrap.go @@ -94,8 +94,7 @@ func (b *Bootstrap) configure(options ...ConfigureOptionFn) { // viper.AddConfigPath(home) viper.SetConfigType("yaml") - configName := fmt.Sprintf("%v.yml", ApplicationName) - viper.SetConfigName(configName) + viper.SetConfigName(fmt.Sprintf("%v.yml", ApplicationName)) } viper.AutomaticEnv() // read in environment variables that match diff --git a/src/app/command/bootstrap_test.go b/src/app/command/bootstrap_test.go index 5e3df70..843ddf0 100644 --- a/src/app/command/bootstrap_test.go +++ b/src/app/command/bootstrap_test.go @@ -1,8 +1,8 @@ package command_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/xfs/utils" "github.com/snivilised/scorpio/src/app/command" "github.com/snivilised/scorpio/src/internal/helpers" diff --git a/src/app/command/command_suite_test.go b/src/app/command/command_suite_test.go index c76f359..7ac0b85 100644 --- a/src/app/command/command_suite_test.go +++ b/src/app/command/command_suite_test.go @@ -3,8 +3,8 @@ package command_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestCommand(t *testing.T) { diff --git a/src/app/command/pool-cmd.go b/src/app/command/pool-cmd.go index 959ddbd..0912d22 100644 --- a/src/app/command/pool-cmd.go +++ b/src/app/command/pool-cmd.go @@ -31,7 +31,7 @@ func buildPoolCommand(container *assistant.CobraContainer) *cobra.Command { // optionally invoke cross field validation // - if xv := ps.CrossValidate(func(ps *react.PoolParameterSet) error { + if xv := ps.CrossValidate(func(_ *react.PoolParameterSet) error { return nil }); xv == nil { options := []string{} diff --git a/src/app/command/pool_cmd_test.go b/src/app/command/pool_cmd_test.go index 75e86cd..d4c5a73 100644 --- a/src/app/command/pool_cmd_test.go +++ b/src/app/command/pool_cmd_test.go @@ -3,8 +3,8 @@ package command_test import ( "fmt" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok xi18n "github.com/snivilised/extendio/i18n" "github.com/snivilised/extendio/xfs/utils" diff --git a/src/app/command/root-cmd_test.go b/src/app/command/root-cmd_test.go index 1ff81bb..186b510 100644 --- a/src/app/command/root-cmd_test.go +++ b/src/app/command/root-cmd_test.go @@ -1,8 +1,8 @@ package command_test import ( - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok "github.com/snivilised/extendio/xfs/utils" "github.com/snivilised/scorpio/src/app/command" diff --git a/src/app/react/pipeline.go b/src/app/react/pipeline.go index b951d9c..3451db1 100644 --- a/src/app/react/pipeline.go +++ b/src/app/react/pipeline.go @@ -36,7 +36,7 @@ func (p *pipeline[I, O]) produce( provider ProviderFn[I], jobChSize int, ) { - p.cancel = func(ctx context.Context, delay time.Duration, cancellations ...context.CancelFunc) { + p.cancel = func(_ context.Context, delay time.Duration, cancellations ...context.CancelFunc) { go CancelProducerAfter[I, O]( delay, cancellations..., diff --git a/src/app/react/pool-entry-point.go b/src/app/react/pool-entry-point.go index 2089959..ee2a3fc 100644 --- a/src/app/react/pool-entry-point.go +++ b/src/app/react/pool-entry-point.go @@ -28,6 +28,7 @@ func EnterPool(ps *PoolParameterSet) error { pipe.produce(ctx, func() TestJobInput { recipient := rand.Intn(len(audience)) //nolint:gosec // trivial sequence++ + return TestJobInput{ sequenceNo: sequence, Recipient: audience[recipient], diff --git a/src/i18n/i18n_suite_test.go b/src/i18n/i18n_suite_test.go index 4cc92d2..dac047d 100644 --- a/src/i18n/i18n_suite_test.go +++ b/src/i18n/i18n_suite_test.go @@ -3,8 +3,8 @@ package i18n_test import ( "testing" - . "github.com/onsi/ginkgo/v2" - . "github.com/onsi/gomega" + . "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok + . "github.com/onsi/gomega" //nolint:revive // gomega ok ) func TestI18n(t *testing.T) { diff --git a/src/internal/log/new-logger.go b/src/internal/log/new-logger.go index ce604d9..8ec332e 100644 --- a/src/internal/log/new-logger.go +++ b/src/internal/log/new-logger.go @@ -16,6 +16,7 @@ func NewLogger(info *LoggerInfo) Ref { if info.Path == "" { panic(i18n.NewInvalidConfigEntryError(info.Path, "-")) } + ws := zapcore.AddSync(&lumberjack.Logger{ Filename: info.Path, MaxSize: info.Rotation.MaxSizeInMb, @@ -29,6 +30,7 @@ func NewLogger(info *LoggerInfo) Ref { ws, info.Level, ) + return zap.New(core) }, func() Logger { return zap.NewNop()