diff --git a/.agola/config.jsonnet b/.agola/config.jsonnet index 04a2258..4319b5f 100644 --- a/.agola/config.jsonnet +++ b/.agola/config.jsonnet @@ -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' }, diff --git a/internal/objectstorage/posix.go b/internal/objectstorage/posix.go index 88d0028..09846e1 100644 --- a/internal/objectstorage/posix.go +++ b/internal/objectstorage/posix.go @@ -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) diff --git a/internal/objectstorage/posixflat.go b/internal/objectstorage/posixflat.go index de4a316..cfa1352 100644 --- a/internal/objectstorage/posixflat.go +++ b/internal/objectstorage/posixflat.go @@ -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 diff --git a/internal/objectstorage/s3.go b/internal/objectstorage/s3.go index 88e3a28..61876ad 100644 --- a/internal/objectstorage/s3.go +++ b/internal/objectstorage/s3.go @@ -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) { diff --git a/services/runservice/types/types.go b/services/runservice/types/types.go index eb0b843..20f16d0 100644 --- a/services/runservice/types/types.go +++ b/services/runservice/types/types.go @@ -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() {