New lint rules

This commit is contained in:
Jamie Curnow
2024-11-21 19:07:36 +10:00
parent 4e6d65645f
commit 152b7666d8
85 changed files with 385 additions and 259 deletions

View File

@ -296,7 +296,7 @@ func (s *testsuite) TestDelete() {
assert.Equal(s.T(), "Unable to delete a new object", err.Error())
m2 := Model{
ModelBase: model.ModelBase{
Base: model.Base{
ID: 10,
},
}

View File

@ -14,7 +14,7 @@ import (
// Model is the model
type Model struct {
model.ModelBase
model.Base
UserID uint `json:"user_id" gorm:"column:user_id" filter:"user_id,integer"`
Name string `json:"name" gorm:"column:name" filter:"name,string"`
AcmeshName string `json:"acmesh_name" gorm:"column:acmesh_name" filter:"acmesh_name,string"`
@ -70,8 +70,8 @@ func (m *Model) GetAcmeShEnvVars() ([]string, error) {
return envs, nil
}
func getEnvsFromMeta(meta interface{}) []string {
if rec, ok := meta.(map[string]interface{}); ok {
func getEnvsFromMeta(meta any) []string {
if rec, ok := meta.(map[string]any); ok {
envs := make([]string, 0)
for key, val := range rec {
if f, ok := val.(string); ok {
@ -81,8 +81,8 @@ func getEnvsFromMeta(meta interface{}) []string {
}
}
return envs
} else {
logger.Debug("getEnvsFromMeta: meta is not an map of strings")
return nil
}
logger.Debug("getEnvsFromMeta: meta is not an map of strings")
return nil
}