Modern Docker Management, Designed for Everyone
Go composecontainer-managementcontainersdockerdocker-composedocker-managementgoself-hostedsveltekittypescriptweb-ui
refactor: update SettingVariable methods to use value receiver and add recvcheck linter
Kyle Mendell6e5ab7fbb2e1
diff --git a/backend/.golangci.yml b/backend/.golangci.ymlindex 2898411fb..37dd3b863 100644--- a/backend/.golangci.yml+++ b/backend/.golangci.yml@@ -32,6 +32,7 @@ linters:- noctx- protogetter- reassign+ - recvcheck- rowserrcheck- spancheck- sqlclosecheckdiff --git a/backend/internal/models/base.go b/backend/internal/models/base.goindex 10f3a98a7..a7025c721 100644--- a/backend/internal/models/base.go+++ b/backend/internal/models/base.go@@ -31,6 +31,7 @@ func (m *BaseModel) BeforeUpdate(_ *gorm.DB) (err error) {return nil}+// nolint:recvchecktype JSON map[string]interface{}func (j JSON) Value() (driver.Value, error) {@@ -55,6 +56,7 @@ func (j *JSON) Scan(value interface{}) error {}}+// nolint:recvchecktype StringSlice []stringfunc (s StringSlice) Value() (driver.Value, error) {diff --git a/backend/internal/models/settings.go b/backend/internal/models/settings.goindex 1da95f002..2fe3c823d 100644--- a/backend/internal/models/settings.go+++ b/backend/internal/models/settings.go@@ -22,19 +22,19 @@ type SettingVariable struct {}// IsTrue returns true if the value is a truthy string-func (s *SettingVariable) IsTrue() bool {+func (s SettingVariable) IsTrue() bool {ok, _ := strconv.ParseBool(s.Value)return ok}// AsInt returns the value as an integer-func (s *SettingVariable) AsInt() int {+func (s SettingVariable) AsInt() int {val, _ := strconv.Atoi(s.Value)return val}// AsDurationSeconds returns the value as a time.Duration in seconds-func (s *SettingVariable) AsDurationSeconds() time.Duration {+func (s SettingVariable) AsDurationSeconds() time.Duration {val, err := strconv.Atoi(s.Value)if err != nil {return 0