From 893f3f6df6651f63fe0fb433a93498e831a486d1 Mon Sep 17 00:00:00 2001 From: LINKIWI Date: Sat, 27 Jan 2024 19:29:10 -0800 Subject: [PATCH] chore: Enable gofmt in linter, fix all outstanding errors (#727) Former-commit-id: 1d9477f510bb2d6ada4b720933f113f24c25913e Former-commit-id: b22ff272ca37181c93c6e83db8f1e1e67a767ebd --- backend/.golangci.yml | 1 + backend/app/api/handlers/v1/v1_ctrl_group.go | 2 +- backend/app/api/handlers/v1/v1_ctrl_items.go | 4 ++-- backend/internal/sys/config/conf.go | 22 ++++++++++---------- 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/backend/.golangci.yml b/backend/.golangci.yml index 7b77c27..8f63110 100644 --- a/backend/.golangci.yml +++ b/backend/.golangci.yml @@ -50,6 +50,7 @@ linters: - goconst - gocritic - gocyclo + - gofmt - goprintffuncname - gosimple - govet diff --git a/backend/app/api/handlers/v1/v1_ctrl_group.go b/backend/app/api/handlers/v1/v1_ctrl_group.go index 0d26869..69bc024 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_group.go +++ b/backend/app/api/handlers/v1/v1_ctrl_group.go @@ -57,7 +57,7 @@ func (ctrl *V1Controller) HandleGroupUpdate() errchain.HandlerFunc { ok := ctrl.svc.Currencies.IsSupported(body.Currency) if !ok { return repo.Group{}, validate.NewFieldErrors( - validate.NewFieldError("currency", "currency '" + body.Currency + "' is not supported"), + validate.NewFieldError("currency", "currency '"+body.Currency+"' is not supported"), ) } diff --git a/backend/app/api/handlers/v1/v1_ctrl_items.go b/backend/app/api/handlers/v1/v1_ctrl_items.go index 6666cc1..062e378 100644 --- a/backend/app/api/handlers/v1/v1_ctrl_items.go +++ b/backend/app/api/handlers/v1/v1_ctrl_items.go @@ -27,7 +27,7 @@ import ( // @Param pageSize query int false "items per page" // @Param labels query []string false "label Ids" collectionFormat(multi) // @Param locations query []string false "location Ids" collectionFormat(multi) -// @Param parentIds query []string false "parent Ids" collectionFormat(multi) +// @Param parentIds query []string false "parent Ids" collectionFormat(multi) // @Success 200 {object} repo.PaginationResult[repo.ItemSummary]{} // @Router /v1/items [GET] // @Security Bearer @@ -57,7 +57,7 @@ func (ctrl *V1Controller) HandleItemsGetAll() errchain.HandlerFunc { Search: params.Get("q"), LocationIDs: queryUUIDList(params, "locations"), LabelIDs: queryUUIDList(params, "labels"), - ParentItemIDs: queryUUIDList(params, "parentIds"), + ParentItemIDs: queryUUIDList(params, "parentIds"), IncludeArchived: queryBool(params.Get("includeArchived")), Fields: filterFieldItems(params["fields"]), OrderBy: params.Get("orderBy"), diff --git a/backend/internal/sys/config/conf.go b/backend/internal/sys/config/conf.go index efc1871..3b84e7d 100644 --- a/backend/internal/sys/config/conf.go +++ b/backend/internal/sys/config/conf.go @@ -17,20 +17,20 @@ const ( type Config struct { conf.Version - Mode string `yaml:"mode" conf:"default:development"` // development or production - Web WebConfig `yaml:"web"` - Storage Storage `yaml:"storage"` - Log LoggerConf `yaml:"logger"` - Mailer MailerConf `yaml:"mailer"` - Demo bool `yaml:"demo"` - Debug DebugConf `yaml:"debug"` - Options Options `yaml:"options"` + Mode string `yaml:"mode" conf:"default:development"` // development or production + Web WebConfig `yaml:"web"` + Storage Storage `yaml:"storage"` + Log LoggerConf `yaml:"logger"` + Mailer MailerConf `yaml:"mailer"` + Demo bool `yaml:"demo"` + Debug DebugConf `yaml:"debug"` + Options Options `yaml:"options"` } type Options struct { - AllowRegistration bool `yaml:"disable_registration" conf:"default:true"` - AutoIncrementAssetID bool `yaml:"auto_increment_asset_id" conf:"default:true"` - CurrencyConfig string `yaml:"currencies"` + AllowRegistration bool `yaml:"disable_registration" conf:"default:true"` + AutoIncrementAssetID bool `yaml:"auto_increment_asset_id" conf:"default:true"` + CurrencyConfig string `yaml:"currencies"` } type DebugConf struct {