Update linters and fumpt all files
Some checks reported errors
continuous-integration/drone/push Build was killed

This commit is contained in:
IamTheFij 2024-01-06 15:10:29 -08:00
parent 90cd0ec9e0
commit cff06cd1c6
8 changed files with 13 additions and 23 deletions

View File

@ -31,10 +31,8 @@ linters:
- gocognit
- goconst
- gocritic
# - gocyclo # Using cyclop
- godot
# - goerr113 # Using errorlint
- gofmt
- gofumpt
- goheader
- goimports
- gomnd
@ -44,7 +42,6 @@ linters:
- gosec
- grouper
- importas
# - ireturn
- lll
- maintidx
- makezero
@ -59,11 +56,9 @@ linters:
- paralleltest
- prealloc
- predeclared
# - promlinter # Not common enough
- revive
- rowserrcheck
- sqlclosecheck
# - stylecheck # Using revive
- tagliatelle
- tenv
- testpackage
@ -71,17 +66,11 @@ linters:
- tparallel
- unconvert
- unparam
- varnamelen
- wastedassign
- whitespace
- wrapcheck
- wsl
disable:
- gochecknoglobals
- godox
- forbidigo
linters-settings:
gomnd:
settings:

View File

@ -13,8 +13,6 @@ repos:
- repo: https://github.com/dnephin/pre-commit-golang
rev: v0.5.1
hooks:
- id: go-fmt
- id: go-imports
- id: golangci-lint
args:
- --timeout=3m

View File

@ -294,7 +294,8 @@ func TestConfigValidation(t *testing.T) {
MySQL: []main.JobTaskMySQL{},
Postgres: []main.JobTaskPostgres{},
Sqlite: []main.JobTaskSqlite{},
}}},
}},
},
expectedErr: main.ErrMissingField,
},
}

View File

@ -31,7 +31,6 @@ func TestReadJobs(t *testing.T) {
t.Parallel()
jobs, err := main.ReadJobs([]string{"./test/sample.hcl"})
if err != nil {
t.Errorf("Unexpected error reading jobs: %v", err)
}

View File

@ -19,7 +19,6 @@ func (m ResticMetrics) PushToGateway(url string) error {
err := push.New(url, "batch").
Gatherer(m.Registry).
Add()
if err != nil {
return fmt.Errorf("error pushing to registry %s: %w", url, err)
}

View File

@ -11,8 +11,10 @@ import (
"time"
)
var ErrRestic = errors.New("restic error")
var ErrRepoNotFound = errors.New("repository not found or uninitialized")
var (
ErrRestic = errors.New("restic error")
ErrRepoNotFound = errors.New("repository not found or uninitialized")
)
func lineIn(needle string, haystack []string) bool {
for _, line := range haystack {

View File

@ -237,7 +237,7 @@ func TestResticInterface(t *testing.T) {
}
// Write test file to the data dir
err := os.WriteFile(dataFile, []byte("testing"), 0644)
err := os.WriteFile(dataFile, []byte("testing"), 0o644)
AssertEqualFail(t, "unexpected error writing to test file", nil, err)
// Make sure no existing repo is found
@ -297,7 +297,7 @@ func TestResticInterface(t *testing.T) {
AssertEqualFail(t, "unexpected error checking repo", nil, err)
// Change the data file
err = os.WriteFile(dataFile, []byte("unexpected"), 0644)
err = os.WriteFile(dataFile, []byte("unexpected"), 0o644)
AssertEqualFail(t, "unexpected error writing to test file", nil, err)
// Check that data wrote

View File

@ -13,8 +13,10 @@ import (
"github.com/robfig/cron/v3"
)
var jobResultsLock = sync.Mutex{}
var jobResults = map[string]JobResult{}
var (
jobResultsLock = sync.Mutex{}
jobResults = map[string]JobResult{}
)
type JobResult struct {
JobName string