diff --git a/api/.golangci.yaml b/api/.golangci.yaml index 5b885de19..ea3923749 100644 --- a/api/.golangci.yaml +++ b/api/.golangci.yaml @@ -5,9 +5,11 @@ linters: # Enable these for now enable: - depguard + - gosimple - govet - errorlint - exportloopref + linters-settings: depguard: rules: diff --git a/api/datastore/backup_test.go b/api/datastore/backup_test.go index 0a82a33db..b09c3cf89 100644 --- a/api/datastore/backup_test.go +++ b/api/datastore/backup_test.go @@ -50,7 +50,7 @@ func TestBackup(t *testing.T) { func TestRestore(t *testing.T) { _, store := MustNewTestStore(t, true, false) - t.Run(fmt.Sprintf("Basic Restore"), func(t *testing.T) { + t.Run("Basic Restore", func(t *testing.T) { // override and set initial db version and edition updateEdition(store, portainer.PortainerCE) updateVersion(store, "2.4") @@ -64,7 +64,7 @@ func TestRestore(t *testing.T) { testVersion(store, "2.4", t) }) - t.Run(fmt.Sprintf("Basic Restore After Multiple Backups"), func(t *testing.T) { + t.Run("Basic Restore After Multiple Backups", func(t *testing.T) { // override and set initial db version and edition updateEdition(store, portainer.PortainerCE) updateVersion(store, "2.4") diff --git a/api/filesystem/filesystem.go b/api/filesystem/filesystem.go index 9eee3b97e..8eed27fa7 100644 --- a/api/filesystem/filesystem.go +++ b/api/filesystem/filesystem.go @@ -173,7 +173,7 @@ func (service *Service) GetStackProjectPathByVersion(stackIdentifier string, ver } if commitHash != "" { - versionStr = fmt.Sprintf("%s", commitHash) + versionStr = commitHash } return JoinPaths(service.wrapFileStore(ComposeStorePath), stackIdentifier, versionStr) } diff --git a/api/kubernetes/yaml.go b/api/kubernetes/yaml.go index 9e38409ec..2e7e785fb 100644 --- a/api/kubernetes/yaml.go +++ b/api/kubernetes/yaml.go @@ -147,11 +147,11 @@ func addResourceLabels(yamlDoc interface{}, appLabels map[string]string) { } for _, v := range m { - switch v.(type) { + switch v := v.(type) { case map[string]interface{}: addResourceLabels(v, appLabels) case []interface{}: - for _, item := range v.([]interface{}) { + for _, item := range v { addResourceLabels(item, appLabels) } }