enable gosimple linter (#10744)

pull/10867/head
Matt Hook 2023-12-18 10:27:24 +13:00 committed by GitHub
parent d98fc1238e
commit 8396ff068d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -5,9 +5,11 @@ linters:
# Enable these for now # Enable these for now
enable: enable:
- depguard - depguard
- gosimple
- govet - govet
- errorlint - errorlint
- exportloopref - exportloopref
linters-settings: linters-settings:
depguard: depguard:
rules: rules:

View File

@ -50,7 +50,7 @@ func TestBackup(t *testing.T) {
func TestRestore(t *testing.T) { func TestRestore(t *testing.T) {
_, store := MustNewTestStore(t, true, false) _, 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 // override and set initial db version and edition
updateEdition(store, portainer.PortainerCE) updateEdition(store, portainer.PortainerCE)
updateVersion(store, "2.4") updateVersion(store, "2.4")
@ -64,7 +64,7 @@ func TestRestore(t *testing.T) {
testVersion(store, "2.4", 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 // override and set initial db version and edition
updateEdition(store, portainer.PortainerCE) updateEdition(store, portainer.PortainerCE)
updateVersion(store, "2.4") updateVersion(store, "2.4")

View File

@ -173,7 +173,7 @@ func (service *Service) GetStackProjectPathByVersion(stackIdentifier string, ver
} }
if commitHash != "" { if commitHash != "" {
versionStr = fmt.Sprintf("%s", commitHash) versionStr = commitHash
} }
return JoinPaths(service.wrapFileStore(ComposeStorePath), stackIdentifier, versionStr) return JoinPaths(service.wrapFileStore(ComposeStorePath), stackIdentifier, versionStr)
} }

View File

@ -147,11 +147,11 @@ func addResourceLabels(yamlDoc interface{}, appLabels map[string]string) {
} }
for _, v := range m { for _, v := range m {
switch v.(type) { switch v := v.(type) {
case map[string]interface{}: case map[string]interface{}:
addResourceLabels(v, appLabels) addResourceLabels(v, appLabels)
case []interface{}: case []interface{}:
for _, item := range v.([]interface{}) { for _, item := range v {
addResourceLabels(item, appLabels) addResourceLabels(item, appLabels)
} }
} }