Skip to content

Commit

Permalink
chore: use golangci-lint for vscode
Browse files Browse the repository at this point in the history
  • Loading branch information
GAlexIHU committed Aug 29, 2024
1 parent db58146 commit 46e603d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,7 @@
},
"gopls": {
"formatting.gofumpt": true
}
},
"go.lintTool": "golangci-lint",
"go.lintFlags": ["--fast", "--fix", "-c", ".golangci.yaml"]
}
20 changes: 10 additions & 10 deletions openmeter/registry/startup/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ func DB(ctx context.Context, cfg config.PostgresConfig, db *db.Client) error {
if !cfg.AutoMigrate.Enabled() {
return nil
}

switch cfg.AutoMigrate {
case config.AutoMigrateEnt:
if err := db.Schema.Create(ctx); err != nil {
return fmt.Errorf("failed to migrate db: %w", err)
}
case config.AutoMigrateMigration:
if err := migrate.Up(cfg.URL); err != nil {
return fmt.Errorf("failed to migrate db: %w", err)
}
case config.AutoMigrateEnt:
if err := db.Schema.Create(ctx); err != nil {
return fmt.Errorf("failed to migrate db: %w", err)
}
case config.AutoMigrateMigration:
if err := migrate.Up(cfg.URL); err != nil {
return fmt.Errorf("failed to migrate db: %w", err)
}
}

return nil
}

0 comments on commit 46e603d

Please sign in to comment.