ci: update golangci-lint to v1.44.2

Fix errors reported by new/updated linters
This commit is contained in:
Simone Gotti 2022-02-24 11:18:29 +01:00
parent 0e8f1c87f6
commit bed726f2d2
5 changed files with 9 additions and 21 deletions

View File

@ -32,7 +32,7 @@ local task_build_go(version, arch) = {
{ type: 'run', command: 'make' },
{ type: 'save_cache', key: 'cache-sum-{{ md5sum "go.sum" }}', contents: [{ source_dir: '/go/pkg/mod/cache' }] },
{ type: 'save_cache', key: 'cache-date-{{ year }}-{{ month }}-{{ day }}', contents: [{ source_dir: '/go/pkg/mod/cache' }] },
{ type: 'run', name: 'install golangci-lint', command: 'curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(go env GOPATH)/bin v1.23.6' },
{ type: 'run', name: 'install golangci-lint', command: 'curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.44.2' },
{ type: 'run', command: 'golangci-lint run --deadline 5m' },
{ type: 'run', name: 'build docker/k8s drivers tests binary', command: 'CGO_ENABLED=0 go test -c ./internal/services/executor/driver -o ./bin/docker-tests' },
{ type: 'run', name: 'build integration tests binary', command: 'go test -tags "sqlite_unlock_notify" -c ./tests -o ./bin/integration-tests' },

View File

@ -164,9 +164,7 @@ func (s *PosixStorage) List(prefix, startWith, delimiter string, doneCh <-chan s
recursive := delimiter == ""
// remove leading slash from prefix
if strings.HasPrefix(prefix, "/") {
prefix = strings.TrimPrefix(prefix, "/")
}
prefix = strings.TrimPrefix(prefix, "/")
fprefix := filepath.Join(s.dataDir, prefix)
root := filepath.Dir(fprefix)
@ -175,9 +173,7 @@ func (s *PosixStorage) List(prefix, startWith, delimiter string, doneCh <-chan s
}
// remove leading slash
if strings.HasPrefix(startWith, "/") {
startWith = strings.TrimPrefix(startWith, "/")
}
startWith = strings.TrimPrefix(startWith, "/")
go func(objectCh chan<- ObjectInfo) {
defer close(objectCh)

View File

@ -338,9 +338,7 @@ func (s *PosixFlatStorage) List(prefix, startWith, delimiter string, doneCh <-ch
recursive := delimiter == ""
// remove leading slash from prefix
if strings.HasPrefix(prefix, "/") {
prefix = strings.TrimPrefix(prefix, "/")
}
prefix = strings.TrimPrefix(prefix, "/")
fprefix := filepath.Join(s.dataDir, escape(prefix))
root := filepath.Dir(fprefix)
@ -349,9 +347,7 @@ func (s *PosixFlatStorage) List(prefix, startWith, delimiter string, doneCh <-ch
}
// remove leading slash
if strings.HasPrefix(startWith, "/") {
startWith = strings.TrimPrefix(startWith, "/")
}
startWith = strings.TrimPrefix(startWith, "/")
go func(objectCh chan<- ObjectInfo) {
var prevp string

View File

@ -129,12 +129,8 @@ func (s *S3Storage) List(prefix, startWith, delimiter string, doneCh <-chan stru
}
// remove leading slash
if strings.HasPrefix(prefix, "/") {
prefix = strings.TrimPrefix(prefix, "/")
}
if strings.HasPrefix(startWith, "/") {
startWith = strings.TrimPrefix(startWith, "/")
}
prefix = strings.TrimPrefix(prefix, "/")
startWith = strings.TrimPrefix(startWith, "/")
// Initiate list objects goroutine here.
go func(objectCh chan<- ObjectInfo) {

View File

@ -162,7 +162,7 @@ func (r *Run) TasksWaitingApproval() []string {
// CanRestartFromScratch reports if the run can be restarted from scratch
func (r *Run) CanRestartFromScratch() (bool, string) {
if r.Phase == RunPhaseSetupError {
return false, fmt.Sprintf("run has setup errors")
return false, "run has setup errors"
}
// can restart only if the run phase is finished or cancelled
if !r.Phase.IsFinished() {
@ -174,7 +174,7 @@ func (r *Run) CanRestartFromScratch() (bool, string) {
// CanRestartFromFailedTasks reports if the run can be restarted from failed tasks
func (r *Run) CanRestartFromFailedTasks() (bool, string) {
if r.Phase == RunPhaseSetupError {
return false, fmt.Sprintf("run has setup errors")
return false, "run has setup errors"
}
// can restart only if the run phase is finished or cancelled
if !r.Phase.IsFinished() {