Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
neoxelox committed Jan 29, 2024
1 parent b41f5dc commit 4c8bfa2
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@ linters-settings:
excludes:
- G114

# Checks to simplify the code.
gosimple:
# Sxxxx checks in https://staticcheck.io/docs/configuration/options/#checks
checks: ["all", "-S1016"]

# Checks for suspicious constructs.
govet:
# Report about shadowed variables.
Expand Down
3 changes: 2 additions & 1 deletion cmd/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ func NewAPI(ctx context.Context, config config.Config) (*API, error) {
healthEndpoints := util.NewHealthEndpoints(observer, database, cache, config)
fileEndpoints := util.NewFileEndpoints(observer, config)

exampleEndpoints := example.NewExampleEndpoints(observer, localizer, exampleGetter, exampleCreator, exampleDeleter, config)
exampleEndpoints := example.NewExampleEndpoints(
observer, localizer, exampleGetter, exampleCreator, exampleDeleter, config)

/* MIDDLEWARES */

Expand Down
6 changes: 4 additions & 2 deletions cmd/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ func NewCLI(ctx context.Context, config config.Config) (*CLI, error) {

/* REGISTRATIONS */

runner.Register(util.DatabaseCommandsRollback, databaseCommands.Rollback, util.DatabaseCommandsRollbackArgs{}, "rollback migrations")
runner.Register(util.DatabaseCommandsRollback, databaseCommands.Rollback,
util.DatabaseCommandsRollbackArgs{}, "rollback migrations")

runner.Use(exampleMiddlewares.HandleCommand)

runner.Register(example.ExampleCommandsForceOnboarding, exampleCommands.ForceOnboarding, example.ExampleCommandsForceOnboardingArgs{}, "force onboarding to an example")
runner.Register(example.ExampleCommandsForceOnboarding, exampleCommands.ForceOnboarding,
example.ExampleCommandsForceOnboardingArgs{}, "force onboarding to an example")

return &CLI{
Run: func(ctx context.Context) error {
Expand Down
2 changes: 1 addition & 1 deletion migrations/0002_example.up.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
CREATE TABLE IF NOT EXISTS "example" (
"id" VARCHAR(20) PRIMARY KEY,
"name" VARCHAR(100) NOT NULL,
"age" INTEGER NOT NULL,
"age" BIGINT NOT NULL,
"country" VARCHAR(2) NOT NULL,
"role" VARCHAR(50) NOT NULL,
"settings" JSONB NOT NULL,
Expand Down
3 changes: 2 additions & 1 deletion pkg/example/creator.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ type ExampleCreator struct {
enqueuer *kit.Enqueuer
}

func NewExampleCreator(observer *kit.Observer, exampleService *ExampleService, exampleRepository *ExampleRepository, enqueuer *kit.Enqueuer, config config.Config) *ExampleCreator {
func NewExampleCreator(observer *kit.Observer, exampleService *ExampleService, exampleRepository *ExampleRepository,
enqueuer *kit.Enqueuer, config config.Config) *ExampleCreator {
return &ExampleCreator{
config: config,
observer: observer,
Expand Down
3 changes: 2 additions & 1 deletion pkg/example/deleter.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ type ExampleDeleter struct {
exampleRepository *ExampleRepository
}

func NewExampleDeleter(observer *kit.Observer, database *kit.Database, exampleRepository *ExampleRepository, config config.Config) *ExampleDeleter {
func NewExampleDeleter(observer *kit.Observer, database *kit.Database, exampleRepository *ExampleRepository,
config config.Config) *ExampleDeleter {
return &ExampleDeleter{
config: config,
observer: observer,
Expand Down
3 changes: 2 additions & 1 deletion pkg/example/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ type ExampleEndpoints struct {
exampleDeleter *ExampleDeleter
}

func NewExampleEndpoints(observer *kit.Observer, localizer *kit.Localizer, exampleGetter *ExampleGetter, exampleCreator *ExampleCreator, exampleDeleter *ExampleDeleter, config config.Config) *ExampleEndpoints {
func NewExampleEndpoints(observer *kit.Observer, localizer *kit.Localizer, exampleGetter *ExampleGetter,
exampleCreator *ExampleCreator, exampleDeleter *ExampleDeleter, config config.Config) *ExampleEndpoints {
return &ExampleEndpoints{
config: config,
observer: observer,
Expand Down
3 changes: 2 additions & 1 deletion pkg/example/getter.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ type ExampleGetter struct {
exampleRepository *ExampleRepository
}

func NewExampleGetter(observer *kit.Observer, cache *kit.Cache, exampleRepository *ExampleRepository, config config.Config) *ExampleGetter {
func NewExampleGetter(observer *kit.Observer, cache *kit.Cache, exampleRepository *ExampleRepository,
config config.Config) *ExampleGetter {
return &ExampleGetter{
config: config,
observer: observer,
Expand Down
6 changes: 4 additions & 2 deletions pkg/example/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ type ExampleServiceGetCountryResult struct {
Country string
}

func (self *ExampleService) GetCountry(ctx context.Context, params ExampleServiceGetCountryParams) (*ExampleServiceGetCountryResult, error) {
response, err := self.client.Request(ctx, "GET", fmt.Sprintf("%s/?name=%s", self.config.ExampleService.BaseURL, params.Name), nil)
func (self *ExampleService) GetCountry(ctx context.Context,
params ExampleServiceGetCountryParams) (*ExampleServiceGetCountryResult, error) {
response, err := self.client.Request(
ctx, "GET", fmt.Sprintf("%s/?name=%s", self.config.ExampleService.BaseURL, params.Name), nil)
if err != nil {
if kit.ErrHTTPClientTimedOut.Is(err) {
return nil, ErrExampleServiceTimedOut.Raise().Cause(err)
Expand Down
2 changes: 1 addition & 1 deletion pkg/example/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (self *ExampleTasks) MakeOnboarding(ctx context.Context, task *asynq.Task)
return nil
}

func (self *ExampleTasks) Reconcile(ctx context.Context, task *asynq.Task) error {
func (self *ExampleTasks) Reconcile(ctx context.Context, _ *asynq.Task) error {
self.observer.Info(ctx, "reconciling examples")

return nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/util/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ type HealthEndpoints struct {
cache *kit.Cache
}

func NewHealthEndpoints(observer *kit.Observer, database *kit.Database, cache *kit.Cache, config config.Config) *HealthEndpoints {
func NewHealthEndpoints(observer *kit.Observer, database *kit.Database, cache *kit.Cache,
config config.Config) *HealthEndpoints {
return &HealthEndpoints{
config: config,
observer: observer,
Expand Down

0 comments on commit 4c8bfa2

Please sign in to comment.