Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
style: error no capitalized && switch && demorgans law (#1125)
Cluas9201c315af29
diff --git a/bin/bb/cmd/dump.go b/bin/bb/cmd/dump.goindex 9da44faffa..d4c99515a8 100644--- a/bin/bb/cmd/dump.go+++ b/bin/bb/cmd/dump.go@@ -25,7 +25,7 @@ func newDumpCmd() *cobra.Command {dumpCmd := &cobra.Command{Use: "dump",Short: "Exports the schema of a database instance",- RunE: func(cmd *cobra.Command, args []string) error {+ RunE: func(cmd *cobra.Command, _ []string) error {u, err := dburl.Parse(dsn)if err != nil {return fmt.Errorf("failed to parse dsn, got error: %w", err)diff --git a/bin/bb/cmd/migrate.go b/bin/bb/cmd/migrate.goindex 86e3d4bbf5..bbfbab78e3 100644--- a/bin/bb/cmd/migrate.go+++ b/bin/bb/cmd/migrate.go@@ -29,7 +29,7 @@ func newMigrateCmd() *cobra.Command {migrateCmd := &cobra.Command{Use: "migrate",Short: "Migrate the database schema",- RunE: func(cmd *cobra.Command, args []string) error {+ RunE: func(_ *cobra.Command, _ []string) error {u, err := dburl.Parse(dsn)if err != nil {return fmt.Errorf("failed to parse dsn, got error: %w", err)diff --git a/bin/bb/cmd/restore.go b/bin/bb/cmd/restore.goindex 941748ef31..4ac3ec336f 100644--- a/bin/bb/cmd/restore.go+++ b/bin/bb/cmd/restore.go@@ -19,7 +19,7 @@ func newRestoreCmd() *cobra.Command {restoreCmd := &cobra.Command{Use: "restore",Short: "restores the schema of a database instance",- RunE: func(cmd *cobra.Command, args []string) error {+ RunE: func(_ *cobra.Command, _ []string) error {u, err := dburl.Parse(dsn)if err != nil {return fmt.Errorf("failed to parse dsn, got error: %w", err)diff --git a/bin/bb/cmd/version.go b/bin/bb/cmd/version.goindex 82a82e20d2..5b0de5a792 100644--- a/bin/bb/cmd/version.go+++ b/bin/bb/cmd/version.go@@ -17,7 +17,7 @@ func newVersionCmd() *cobra.Command {versionCmd := &cobra.Command{Use: "version",Short: "Print the version of bb",- Run: func(cmd *cobra.Command, args []string) {+ Run: func(cmd *cobra.Command, _ []string) {out := cmd.OutOrStdout()fmt.Fprintf(out, "bb version: %s\n", version)fmt.Fprintf(out, "Golang version: %s\n", goversion)diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex 47dd82941e..52b01e0ad6 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -100,7 +100,7 @@ var (rootCmd = &cobra.Command{Use: "bytebase",Short: "Bytebase is a database schema change and version control tool",- Run: func(cmd *cobra.Command, args []string) {+ Run: func(_ *cobra.Command, _ []string) {if frontendHost == "" {frontendHost = host}diff --git a/bin/server/cmd/version.go b/bin/server/cmd/version.goindex 20b1f86f42..3ec3afb21e 100644--- a/bin/server/cmd/version.go+++ b/bin/server/cmd/version.go@@ -20,7 +20,7 @@ func init() {var versionCmd = &cobra.Command{Use: "version",Short: "Print the version of Bytebase",- Run: func(cmd *cobra.Command, args []string) {+ Run: func(_ *cobra.Command, _ []string) {fmt.Printf("Bytebase version: %s\n", version)fmt.Printf("Golang version: %s\n", goversion)fmt.Printf("Git commit hash: %s\n", gitcommit)diff --git a/server/acl.go b/server/acl.goindex 2e49d5c236..186c7bdb8c 100644--- a/server/acl.go+++ b/server/acl.go@@ -92,16 +92,17 @@ func aclMiddleware(l *zap.Logger, s *Server, ce *casbin.Enforcer, next echo.Hand}func isOperatingSelf(ctx context.Context, c echo.Context, s *Server, curPrincipalID int, method string) (bool, error) {- if method == "GET" {+ switch method {+ case http.MethodGet:return isGettingSelf(ctx, c, s, curPrincipalID)- } else if method == "PATCH" || method == "DELETE" {+ case http.MethodPatch, http.MethodDelete:return isUpdatingSelf(ctx, c, s, curPrincipalID)+ default:+ return false, nil}-- return false, nil}-func isGettingSelf(ctx context.Context, c echo.Context, s *Server, curPrincipalID int) (bool, error) {+func isGettingSelf(_ context.Context, c echo.Context, _ *Server, curPrincipalID int) (bool, error) {if strings.HasPrefix(c.Path(), "/api/inbox/user") {userID, err := strconv.Atoi(c.Param("userID"))if err != nil {diff --git a/server/activity_manager.go b/server/activity_manager.goindex 90b85e42b6..bb3529f716 100644--- a/server/activity_manager.go+++ b/server/activity_manager.go@@ -91,7 +91,7 @@ func (m *ActivityManager) CreateActivity(ctx context.Context, create *api.Activireturn nil, fmt.Errorf("failed to find updater for posting webhook event after changing the issue status: %v, error: %w", meta.issue.Name, err)}if updater == nil {- return nil, fmt.Errorf("Updater principal not found for ID %v", create.CreatorID)+ return nil, fmt.Errorf("updater principal not found for ID %v", create.CreatorID)}// Call external webhook endpoint in Go routine to avoid blocking web serveing thread.@@ -173,7 +173,7 @@ func (m *ActivityManager) getWebhookContext(ctx context.Context, activity *api.Areturn webhookCtx, err}if oldAssignee == nil {- err := fmt.Errorf("Failed to post webhook event after changing the issue assignee, old assignee not found for ID %v", oldID)+ err := fmt.Errorf("failed to post webhook event after changing the issue assignee, old assignee not found for ID %v", oldID)m.s.l.Warn(err.Error(),zap.String("issue_name", meta.issue.Name),zap.String("old_assignee_id", update.OldValue),@@ -203,7 +203,7 @@ func (m *ActivityManager) getWebhookContext(ctx context.Context, activity *api.Areturn webhookCtx, err}if newAssignee == nil {- err := fmt.Errorf("Failed to post webhook event after changing the issue assignee, new assignee not found for ID %v", newID)+ err := fmt.Errorf("failed to post webhook event after changing the issue assignee, new assignee not found for ID %v", newID)m.s.l.Warn(err.Error(),zap.String("issue_name", meta.issue.Name),zap.String("new_assignee_id", update.NewValue),@@ -248,7 +248,7 @@ func (m *ActivityManager) getWebhookContext(ctx context.Context, activity *api.Areturn webhookCtx, err}if task == nil {- err := fmt.Errorf("Failed to post webhook event after changing the issue task status, task not found for ID %v", update.TaskID)+ err := fmt.Errorf("failed to post webhook event after changing the issue task status, task not found for ID %v", update.TaskID)m.s.l.Warn(err.Error(),zap.String("issue_name", meta.issue.Name),zap.Int("task_id", update.TaskID),@@ -259,9 +259,10 @@ func (m *ActivityManager) getWebhookContext(ctx context.Context, activity *api.Atitle = "Task changed - " + task.Nameswitch update.NewStatus {case api.TaskPending:- if update.OldStatus == api.TaskRunning {+ switch update.OldStatus {+ case api.TaskRunning:title = "Task canceled - " + task.Name- } else if update.OldStatus == api.TaskPendingApproval {+ case api.TaskPendingApproval:title = "Task approved - " + task.Name}case api.TaskRunning:diff --git a/server/auth.go b/server/auth.goindex 3ffd8b2964..8fb10d6535 100644--- a/server/auth.go+++ b/server/auth.go@@ -9,7 +9,6 @@ import ("github.com/bytebase/bytebase/api""github.com/bytebase/bytebase/common""github.com/bytebase/bytebase/plugin/vcs"- vcsPlugin "github.com/bytebase/bytebase/plugin/vcs""github.com/google/jsonapi""github.com/labstack/echo/v4""golang.org/x/crypto/bcrypt"@@ -92,7 +91,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {}// exchange OAuth Token- oauthToken, err := vcsPlugin.Get(vcsFound.Type, vcsPlugin.ProviderConfig{Logger: s.l}).ExchangeOAuthToken(+ oauthToken, err := vcs.Get(vcsFound.Type, vcs.ProviderConfig{Logger: s.l}).ExchangeOAuthToken(ctx,vcsFound.InstanceURL,&common.OAuthExchange{@@ -106,7 +105,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to exchange OAuth token").SetInternal(err)}- gitlabUserInfo, err := vcsPlugin.Get(vcs.GitLabSelfHost, vcsPlugin.ProviderConfig{Logger: s.l}).TryLogin(ctx,+ gitlabUserInfo, err := vcs.Get(vcs.GitLabSelfHost, vcs.ProviderConfig{Logger: s.l}).TryLogin(ctx,common.OauthContext{ClientID: vcsFound.ApplicationID,ClientSecret: vcsFound.Secret,@@ -121,7 +120,7 @@ func (s *Server) registerAuthRoutes(g *echo.Group) {}// we only allow active user to login via gitlab- if gitlabUserInfo.State != vcsPlugin.StateActive {+ if gitlabUserInfo.State != vcs.StateActive {return echo.NewHTTPError(http.StatusUnauthorized, "Fail to login via Gitlab, user is Archived")}diff --git a/server/backup_runner.go b/server/backup_runner.goindex ba20a0bb01..64d1f87a85 100644--- a/server/backup_runner.go+++ b/server/backup_runner.go@@ -85,7 +85,7 @@ func (s *BackupRunner) Run(ctx context.Context, wg *sync.WaitGroup) {continue}if db == nil {- err := fmt.Errorf("Failed to get database for backup setting, database ID not found %v", backupSetting.DatabaseID)+ err := fmt.Errorf("failed to get database for backup setting, database ID not found %v", backupSetting.DatabaseID)s.l.Error(err.Error(),zap.Int("id", backupSetting.ID),zap.Int("databaseID", backupSetting.DatabaseID),diff --git a/server/database.go b/server/database.goindex cdd7c25124..4e8dc2c389 100644--- a/server/database.go+++ b/server/database.go@@ -30,7 +30,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find instance").SetInternal(err)}if instance == nil {- err := fmt.Errorf("Instance ID not found %v", databaseCreate.InstanceID)+ err := fmt.Errorf("instance ID not found %v", databaseCreate.InstanceID)return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)}databaseCreate.EnvironmentID = instance.EnvironmentID@@ -39,7 +39,7 @@ func (s *Server) registerDatabaseRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find project").SetInternal(err)}if project == nil {- err := fmt.Errorf("Project ID not found %v", databaseCreate.ProjectID)+ err := fmt.Errorf("project ID not found %v", databaseCreate.ProjectID)return echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)}if project.TenantMode == api.TenantModeTenant && !s.feature(api.FeatureMultiTenancy) {diff --git a/server/environment.go b/server/environment.goindex 63ce9258b4..2c69112334 100644--- a/server/environment.go+++ b/server/environment.go@@ -98,7 +98,7 @@ func (s *Server) registerEnvironmentRoutes(g *echo.Group) {for _, item := range patchList {envPatch, ok := item.(*api.EnvironmentPatch)if !ok {- return echo.NewHTTPError(http.StatusBadRequest, "Malformatted environment reorder request").SetInternal(errors.New("Failed to convert request item to *api.EnvironmentPatch"))+ return echo.NewHTTPError(http.StatusBadRequest, "Malformatted environment reorder request").SetInternal(errors.New("failed to convert request item to *api.EnvironmentPatch"))}envPatch.UpdaterID = c.Get(getPrincipalIDContextKey()).(int)if _, err := s.store.PatchEnvironment(ctx, envPatch); err != nil {diff --git a/server/issue.go b/server/issue.goindex e39b0355f9..33ba2369a7 100644--- a/server/issue.go+++ b/server/issue.go@@ -270,7 +270,7 @@ func (s *Server) composeIssueByID(ctx context.Context, id int) (*api.Issue, erroreturn nil, err}if id > 0 && issueRaw == nil {- return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("Issue not found with ID %v", id)}+ return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("issue not found with ID %v", id)}}if issueRaw == nil {@@ -383,7 +383,7 @@ func (s *Server) validateAssigneeRoleByID(ctx context.Context, assigneeID int) ereturn err}if assignee == nil {- return fmt.Errorf("Principal ID not found: %d", assigneeID)+ return fmt.Errorf("principal ID not found: %d", assigneeID)}if assignee.Role != api.Owner && assignee.Role != api.DBA {return fmt.Errorf("%s is not allowed as assignee", assignee.Role)@@ -544,8 +544,8 @@ func (s *Server) createPipelineValidateOnly(ctx context.Context, pc *api.Pipelinfunc (s *Server) createPipelineFromIssue(ctx context.Context, issueCreate *api.IssueCreate, creatorID int, validateOnly bool) (*api.Pipeline, error) {var pipelineCreate *api.PipelineCreate- switch {- case issueCreate.Type == api.IssueDatabaseCreate:+ switch issueCreate.Type {+ case api.IssueDatabaseCreate:m := api.CreateDatabaseContext{}if err := json.Unmarshal([]byte(issueCreate.CreateContext), &m); err != nil {return nil, err@@ -736,7 +736,7 @@ func (s *Server) createPipelineFromIssue(ctx context.Context, issueCreate *api.I},}}- case issueCreate.Type == api.IssueDatabaseSchemaUpdate || issueCreate.Type == api.IssueDatabaseDataUpdate:+ case api.IssueDatabaseSchemaUpdate, api.IssueDatabaseDataUpdate:m := api.UpdateSchemaContext{}if err := json.Unmarshal([]byte(issueCreate.CreateContext), &m); err != nil {return nil, err@@ -770,7 +770,7 @@ func (s *Server) createPipelineFromIssue(ctx context.Context, issueCreate *api.Iif !s.feature(api.FeatureMultiTenancy) {return nil, echo.NewHTTPError(http.StatusForbidden, api.FeatureMultiTenancy.AccessErrorMessage())}- if !(m.MigrationType == db.Migrate || m.MigrationType == db.Data) {+ if m.MigrationType != db.Migrate && m.MigrationType != db.Data {return nil, echo.NewHTTPError(http.StatusBadRequest, "Only Migrate and Data type migration can be performed on tenant mode project")}if len(m.UpdateSchemaDetailList) != 1 {@@ -937,9 +937,10 @@ func (s *Server) createPipelineFromIssue(ctx context.Context, issueCreate *api.Ifunc getUpdateTask(database *api.Database, migrationType db.MigrationType, vcsPushEvent *vcs.PushEvent, d *api.UpdateSchemaDetail, schemaVersion string, taskStatus api.TaskStatus) (*api.TaskCreate, error) {taskName := fmt.Sprintf("Establish %q baseline", database.Name)- if migrationType == db.Migrate {+ switch migrationType {+ case db.Migrate:taskName = fmt.Sprintf("Update %q schema", database.Name)- } else if migrationType == db.Data {+ case db.Data:taskName = fmt.Sprintf("Update %q data", database.Name)}payload := api.TaskDatabaseSchemaUpdatePayload{}@@ -1214,7 +1215,7 @@ func (s *Server) getSchemaFromPeerTenantDatabase(ctx context.Context, instance *}}if found {- err := fmt.Errorf("Conflicting database name, project has existing base database named %q, but it's not from the selected peer tenants", baseDatabaseName)+ err := fmt.Errorf("conflicting database name, project has existing base database named %q, but it's not from the selected peer tenants", baseDatabaseName)return "", "", echo.NewHTTPError(http.StatusBadRequest, err.Error()).SetInternal(err)}return "", "", nildiff --git a/server/pipeline.go b/server/pipeline.goindex 9079489f29..83dd95c638 100644--- a/server/pipeline.go+++ b/server/pipeline.go@@ -17,7 +17,7 @@ func (s *Server) composePipelineByID(ctx context.Context, id int) (*api.Pipelinereturn nil, err}if pipelineRaw == nil {- return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("Pipeline not found with ID %v", id)}+ return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("pipeline not found with ID %v", id)}}pipeline, err := s.composePipelineRelationship(ctx, pipelineRaw)diff --git a/server/project.go b/server/project.goindex 5cb0665601..e50caaa61f 100644--- a/server/project.go+++ b/server/project.go@@ -586,7 +586,7 @@ func (s *Server) composeProjectByID(ctx context.Context, id int) (*api.Project,return nil, err}if projectRaw == nil {- return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("Project not found with ID %d", id)}+ return nil, &common.Error{Code: common.NotFound, Err: fmt.Errorf("project not found with ID %d", id)}}project, err := s.composeProjectRelationship(ctx, projectRaw)diff --git a/server/server_embed_dev.go b/server/server_embed_dev.goindex 90d3faae1c..b9792504fc 100644--- a/server/server_embed_dev.go+++ b/server/server_embed_dev.go@@ -8,6 +8,6 @@ import ("go.uber.org/zap")-func embedFrontend(logger *zap.Logger, e *echo.Echo) {+func embedFrontend(logger *zap.Logger, _ *echo.Echo) {logger.Info("Dev mode, skip embedding frontend")}diff --git a/server/sql.go b/server/sql.goindex b385b83793..839552e8a6 100644--- a/server/sql.go+++ b/server/sql.go@@ -474,13 +474,13 @@ func (s *Server) syncEngineVersionAndSchema(ctx context.Context, instance *api.I}dbRawList, err := s.DatabaseService.FindDatabaseList(ctx, databaseFind)if err != nil {- return fmt.Errorf("Failed to sync database for instance: %s. Failed to find database list. Error %w", instance.Name, err)+ return fmt.Errorf("failed to sync database for instance: %s. Failed to find database list. Error %w", instance.Name, err)}var dbList []*api.Databasefor _, dbRaw := range dbRawList {db, err := s.composeDatabaseRelationship(ctx, dbRaw)if err != nil {- return fmt.Errorf("Failed to compose database relationship with ID %v, error: %v", dbRaw.ID, err)+ return fmt.Errorf("failed to compose database relationship with ID %v, error: %v", dbRaw.ID, err)}dbList = append(dbList, db)}@@ -520,7 +520,7 @@ func (s *Server) syncEngineVersionAndSchema(ctx context.Context, instance *api.I}dbPatched, err := s.composeDatabaseRelationship(ctx, dbRawPatched)if err != nil {- return fmt.Errorf("Failed to compose database relationship with ID %v, error: %v", dbRawPatched.ID, err)+ return fmt.Errorf("failed to compose database relationship with ID %v, error: %v", dbRawPatched.ID, err)}tableDelete := &api.TableDelete{@@ -571,7 +571,7 @@ func (s *Server) syncEngineVersionAndSchema(ctx context.Context, instance *api.I}db, err := s.composeDatabaseRelationship(ctx, dbRaw)if err != nil {- return fmt.Errorf("Failed to compose database relationship with ID %v, error: %v", dbRaw.ID, err)+ return fmt.Errorf("failed to compose database relationship with ID %v, error: %v", dbRaw.ID, err)}for _, table := range schema.TableList {@@ -650,7 +650,7 @@ func validateSQLSelectStatement(sqlStatement string) bool {// Check if the query has only one statement.count := 0sc := bufio.NewScanner(strings.NewReader(sqlStatement))- if err := util.ApplyMultiStatements(sc, func(stmt string) error {+ if err := util.ApplyMultiStatements(sc, func(_ string) error {count++return nil}); err != nil {diff --git a/server/task.go b/server/task.goindex 0a6c309d1e..47ea3eb438 100644--- a/server/task.go+++ b/server/task.go@@ -96,7 +96,8 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {}newStatement = *taskPatch.Statement- if task.Type == api.TaskDatabaseSchemaUpdate {+ switch task.Type {+ case api.TaskDatabaseSchemaUpdate:payload := &api.TaskDatabaseSchemaUpdatePayload{}if err := json.Unmarshal([]byte(task.Payload), payload); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted database schema update payload").SetInternal(err)@@ -112,7 +113,8 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {}payloadStr := string(bytes)taskPatch.Payload = &payloadStr- } else if task.Type == api.TaskDatabaseDataUpdate {+ case api.TaskDatabaseDataUpdate:+payload := &api.TaskDatabaseDataUpdatePayload{}if err := json.Unmarshal([]byte(task.Payload), payload); err != nil {return echo.NewHTTPError(http.StatusBadRequest, "Malformatted database data update payload").SetInternal(err)@@ -128,6 +130,7 @@ func (s *Server) registerTaskRoutes(g *echo.Group) {}payloadStr := string(bytes)taskPatch.Payload = &payloadStr+}}diff --git a/server/task_executor_database_backup.go b/server/task_executor_database_backup.goindex 23b1add2ff..062bbf935a 100644--- a/server/task_executor_database_backup.go+++ b/server/task_executor_database_backup.go@@ -44,7 +44,7 @@ func (exec *DatabaseBackupTaskExecutor) RunOnce(ctx context.Context, server *Serbackup, err := server.store.GetBackupByID(ctx, payload.BackupID)if err != nil {- return true, nil, fmt.Errorf("Failed to find backup with ID[%d], error[%w]", payload.BackupID, err)+ return true, nil, fmt.Errorf("failed to find backup with ID[%d], error[%w]", payload.BackupID, err)}if backup == nil {return true, nil, fmt.Errorf("backup %v not found", payload.BackupID)diff --git a/server/task_executor_database_create.go b/server/task_executor_database_create.goindex 2372bbc8ec..aac35596af 100644--- a/server/task_executor_database_create.go+++ b/server/task_executor_database_create.go@@ -99,7 +99,7 @@ func (exec *DatabaseCreateTaskExecutor) RunOnce(ctx context.Context, server *Ser)}if issue == nil {- err := fmt.Errorf("Failed to fetch containing issue for composing the migration info, issue not found with pipeline ID %v", task.PipelineID)+ err := fmt.Errorf("failed to fetch containing issue for composing the migration info, issue not found with pipeline ID %v", task.PipelineID)exec.l.Error(err.Error(),zap.Int("task_id", task.ID),zap.Error(err),diff --git a/server/task_executor_database_restore.go b/server/task_executor_database_restore.goindex f4c7998d91..1a3fa5877f 100644--- a/server/task_executor_database_restore.go+++ b/server/task_executor_database_restore.go@@ -48,7 +48,7 @@ func (exec *DatabaseRestoreTaskExecutor) RunOnce(ctx context.Context, server *Sebackup, err := server.store.GetBackupByID(ctx, payload.BackupID)if err != nil {- return true, nil, fmt.Errorf("Failed to find backup with ID[%d], error[%w]", payload.BackupID, err)+ return true, nil, fmt.Errorf("failed to find backup with ID[%d], error[%w]", payload.BackupID, err)}if backup == nil {return true, nil, fmt.Errorf("backup with ID[%d] not found", payload.BackupID)diff --git a/server/vcs.go b/server/vcs.goindex 49ccd075c2..236a0514c2 100644--- a/server/vcs.go+++ b/server/vcs.go@@ -10,7 +10,6 @@ import ("github.com/bytebase/bytebase/api""github.com/bytebase/bytebase/common""github.com/bytebase/bytebase/plugin/vcs"- vcsPlugin "github.com/bytebase/bytebase/plugin/vcs""github.com/google/jsonapi""github.com/labstack/echo/v4")@@ -172,7 +171,7 @@ func (s *Server) registerVCSRoutes(g *echo.Group) {return echo.NewHTTPError(http.StatusNotFound, fmt.Sprintf("Failed to find VCS, ID: %v", id))}- externalRepoListRaw, err := vcsPlugin.Get(vcsFound.Type, vcsPlugin.ProviderConfig{Logger: s.l}).FetchRepositoryList(+ externalRepoListRaw, err := vcs.Get(vcsFound.Type, vcs.ProviderConfig{Logger: s.l}).FetchRepositoryList(ctx,common.OauthContext{ClientID: vcsFound.ApplicationID,diff --git a/server/webhook.go b/server/webhook.goindex bfe32cdd5a..6677ed1100 100644--- a/server/webhook.go+++ b/server/webhook.go@@ -280,7 +280,7 @@ func (s *Server) createSchemaUpdateIssue(ctx context.Context, repository *api.Re}}if len(multipleDatabaseForSameEnv) > 0 {- return "", fmt.Errorf("Ignored committed files with multiple ambiguous databases %s", strings.Join(multipleDatabaseForSameEnv, ", "))+ return "", fmt.Errorf("ignored committed files with multiple ambiguous databases %s", strings.Join(multipleDatabaseForSameEnv, ", "))}// Compose the new issue@@ -297,7 +297,7 @@ func (s *Server) createSchemaUpdateIssue(ctx context.Context, repository *api.Re}createContext, err := json.Marshal(m)if err != nil {- return "", fmt.Errorf("Failed to construct issue create context payload, error %v", err)+ return "", fmt.Errorf("failed to construct issue create context payload, error %v", err)}return string(createContext), nil}@@ -319,7 +319,7 @@ func (s *Server) createTenantSchemaUpdateIssue(ctx context.Context, repository *}createContext, err := json.Marshal(m)if err != nil {- return "", fmt.Errorf("Failed to construct issue create context payload, error %v", err)+ return "", fmt.Errorf("failed to construct issue create context payload, error %v", err)}return string(createContext), nil}diff --git a/store/activity.go b/store/activity.goindex cf8fd99b44..fcd3ea9048 100644--- a/store/activity.go+++ b/store/activity.go@@ -57,11 +57,11 @@ func (raw *activityRaw) toActivity() *api.Activity {func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate) (*api.Activity, error) {activityRaw, err := s.createActivityRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Activity with ActivityCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Activity with ActivityCreate[%+v], error[%w]", create, err)}activity, err := s.composeActivity(ctx, activityRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)}return activity, nil}@@ -70,14 +70,14 @@ func (s *Store) CreateActivity(ctx context.Context, create *api.ActivityCreate)func (s *Store) GetActivityByID(ctx context.Context, id int) (*api.Activity, error) {activityRaw, err := s.getActivityRawByID(ctx, id)if err != nil {- return nil, fmt.Errorf("Failed to get Activity with ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get Activity with ID[%d], error[%w]", id, err)}if activityRaw == nil {return nil, nil}activity, err := s.composeActivity(ctx, activityRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)}return activity, nil}@@ -86,13 +86,13 @@ func (s *Store) GetActivityByID(ctx context.Context, id int) (*api.Activity, errfunc (s *Store) FindActivity(ctx context.Context, find *api.ActivityFind) ([]*api.Activity, error) {activityRawList, err := s.findActivityRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Activity list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Activity list, error[%w]", err)}var activityList []*api.Activityfor _, raw := range activityRawList {activity, err := s.composeActivity(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Activity with activityRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", raw, err)}activityList = append(activityList, activity)}@@ -103,11 +103,11 @@ func (s *Store) FindActivity(ctx context.Context, find *api.ActivityFind) ([]*apfunc (s *Store) PatchActivity(ctx context.Context, patch *api.ActivityPatch) (*api.Activity, error) {activityRaw, err := s.patchActivityRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Activity with ActivityPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Activity with ActivityPatch[%+v], error[%w]", patch, err)}activity, err := s.composeActivity(ctx, activityRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)+ return nil, fmt.Errorf("failed to compose Activity with activityRaw[%+v], error[%w]", activityRaw, err)}return activity, nil}diff --git a/store/anomaly.go b/store/anomaly.goindex cc745b67fa..9dfbaa1269 100644--- a/store/anomaly.go+++ b/store/anomaly.go@@ -60,11 +60,11 @@ func (raw *anomalyRaw) toAnomaly() *api.Anomaly {func (s *Store) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpsert) (*api.Anomaly, error) {anomalyRaw, err := s.upsertActiveAnomalyRaw(ctx, upsert)if err != nil {- return nil, fmt.Errorf("Failed to upsert active anomaly with AnomalyUpsert[%+v], error[%w]", upsert, err)+ return nil, fmt.Errorf("failed to upsert active anomaly with AnomalyUpsert[%+v], error[%w]", upsert, err)}anomaly, err := s.composeAnomaly(ctx, anomalyRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose anomaly with AnomalyRaw[%+v], error[%w]", anomalyRaw, err)+ return nil, fmt.Errorf("failed to compose anomaly with AnomalyRaw[%+v], error[%w]", anomalyRaw, err)}return anomaly, nil}@@ -73,13 +73,13 @@ func (s *Store) UpsertActiveAnomaly(ctx context.Context, upsert *api.AnomalyUpsefunc (s *Store) FindAnomaly(ctx context.Context, find *api.AnomalyFind) ([]*api.Anomaly, error) {anomalyRawList, err := s.findAnomalyRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find anomaly with AnomalyFind[%+v], error[%w]", find, err)+ return nil, fmt.Errorf("failed to find anomaly with AnomalyFind[%+v], error[%w]", find, err)}var anomalyList []*api.Anomalyfor _, anomalyRaw := range anomalyRawList {anomaly, err := s.composeAnomaly(ctx, anomalyRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose anomaly with AnomalyRaw[%+v], error[%w]", anomalyRaw, err)+ return nil, fmt.Errorf("failed to compose anomaly with AnomalyRaw[%+v], error[%w]", anomalyRaw, err)}anomalyList = append(anomalyList, anomaly)}diff --git a/store/backup.go b/store/backup.goindex 2776fb237b..d34e67ea33 100644--- a/store/backup.go+++ b/store/backup.go@@ -110,11 +110,11 @@ func (raw *backupSettingRaw) toBackupSetting() *api.BackupSetting {func (s *Store) CreateBackup(ctx context.Context, create *api.BackupCreate) (*api.Backup, error) {backupRaw, err := s.createBackupRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Backup with BackupCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Backup with BackupCreate[%+v], error[%w]", create, err)}backup, err := s.composeBackup(ctx, backupRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)}return backup, nil}@@ -123,14 +123,14 @@ func (s *Store) CreateBackup(ctx context.Context, create *api.BackupCreate) (*apfunc (s *Store) GetBackupByID(ctx context.Context, id int) (*api.Backup, error) {backupRaw, err := s.getBackupRawByID(ctx, id)if err != nil {- return nil, fmt.Errorf("Failed to get backup setting by ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get backup setting by ID[%d], error[%w]", id, err)}if backupRaw == nil {return nil, nil}backupSetting, err := s.composeBackup(ctx, backupRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)}return backupSetting, nil}@@ -139,13 +139,13 @@ func (s *Store) GetBackupByID(ctx context.Context, id int) (*api.Backup, error)func (s *Store) FindBackup(ctx context.Context, find *api.BackupFind) ([]*api.Backup, error) {backupRawList, err := s.findBackupRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Backup list with BackupFind[%+v], error[%w]", find, err)+ return nil, fmt.Errorf("failed to find Backup list with BackupFind[%+v], error[%w]", find, err)}var backupList []*api.Backupfor _, raw := range backupRawList {backup, err := s.composeBackup(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Backup with backupRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", raw, err)}backupList = append(backupList, backup)}@@ -156,11 +156,11 @@ func (s *Store) FindBackup(ctx context.Context, find *api.BackupFind) ([]*api.Bafunc (s *Store) PatchBackup(ctx context.Context, patch *api.BackupPatch) (*api.Backup, error) {backupRaw, err := s.patchBackupRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Backup with BackupPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Backup with BackupPatch[%+v], error[%w]", patch, err)}backup, err := s.composeBackup(ctx, backupRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupRaw, err)}return backup, nil}@@ -169,14 +169,14 @@ func (s *Store) PatchBackup(ctx context.Context, patch *api.BackupPatch) (*api.Bfunc (s *Store) GetBackupSettingByDatabaseID(ctx context.Context, id int) (*api.BackupSetting, error) {backupSettingRaw, err := s.getBackupSettingRaw(ctx, &api.BackupSettingFind{DatabaseID: &id})if err != nil {- return nil, fmt.Errorf("Failed to get backup setting by ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get backup setting by ID[%d], error[%w]", id, err)}if backupSettingRaw == nil {return nil, nil}backupSetting, err := s.composeBackupSetting(ctx, backupSettingRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose BackupSetting with backupSettingRaw[%+v], error[%w]", backupSettingRaw, err)+ return nil, fmt.Errorf("failed to compose BackupSetting with backupSettingRaw[%+v], error[%w]", backupSettingRaw, err)}return backupSetting, nil}@@ -185,11 +185,11 @@ func (s *Store) GetBackupSettingByDatabaseID(ctx context.Context, id int) (*api.func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettingUpsert) (*api.BackupSetting, error) {backupSettingRaw, err := s.upsertBackupSettingRaw(ctx, upsert)if err != nil {- return nil, fmt.Errorf("Failed to upsert backup setting with BackupSettingUpsert[%+v], error[%w]", upsert, err)+ return nil, fmt.Errorf("failed to upsert backup setting with BackupSettingUpsert[%+v], error[%w]", upsert, err)}backup, err := s.composeBackupSetting(ctx, backupSettingRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Backup with backupRaw[%+v], error[%w]", backupSettingRaw, err)+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", backupSettingRaw, err)}return backup, nil}@@ -198,13 +198,13 @@ func (s *Store) UpsertBackupSetting(ctx context.Context, upsert *api.BackupSettifunc (s *Store) FindBackupSettingsMatch(ctx context.Context, match *api.BackupSettingsMatch) ([]*api.BackupSetting, error) {backupSettingRawList, err := s.findBackupSettingsMatchImpl(ctx, match)if err != nil {- return nil, fmt.Errorf("Failed to find matching backup setting list with BackupSettingsMatch[%+v], error[%w]", match, err)+ return nil, fmt.Errorf("failed to find matching backup setting list with BackupSettingsMatch[%+v], error[%w]", match, err)}var backupSettingList []*api.BackupSettingfor _, raw := range backupSettingRawList {backupSetting, err := s.composeBackupSetting(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Backup with backupRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Backup with backupRaw[%+v], error[%w]", raw, err)}backupSettingList = append(backupSettingList, backupSetting)}diff --git a/store/bookmark.go b/store/bookmark.goindex 9bf61f4b64..2490947e17 100644--- a/store/bookmark.go+++ b/store/bookmark.go@@ -48,11 +48,11 @@ func (raw *bookmarkRaw) toBookmark() *api.Bookmark {func (s *Store) CreateBookmark(ctx context.Context, create *api.BookmarkCreate) (*api.Bookmark, error) {bookmarkRaw, err := s.createBookmarkRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Bookmark with BookmarkCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Bookmark with BookmarkCreate[%+v], error[%w]", create, err)}bookmark, err := s.composeBookmark(ctx, bookmarkRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", bookmarkRaw, err)+ return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", bookmarkRaw, err)}return bookmark, nil}@@ -62,14 +62,14 @@ func (s *Store) GetBookmarkByID(ctx context.Context, id int) (*api.Bookmark, errfind := &api.BookmarkFind{ID: &id}bookmarkRaw, err := s.getBookmarkRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get Bookmark with ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get Bookmark with ID[%d], error[%w]", id, err)}if bookmarkRaw == nil {return nil, nil}bookmark, err := s.composeBookmark(ctx, bookmarkRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", bookmarkRaw, err)+ return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", bookmarkRaw, err)}return bookmark, nil}@@ -78,13 +78,13 @@ func (s *Store) GetBookmarkByID(ctx context.Context, id int) (*api.Bookmark, errfunc (s *Store) FindBookmark(ctx context.Context, find *api.BookmarkFind) ([]*api.Bookmark, error) {bookmarkRawList, err := s.findBookmarkRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Bookmark list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Bookmark list, error[%w]", err)}var bookmarkList []*api.Bookmarkfor _, raw := range bookmarkRawList {bookmark, err := s.composeBookmark(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Bookmark with bookmarkRaw[%+v], error[%w]", raw, err)}bookmarkList = append(bookmarkList, bookmark)}diff --git a/store/data_source.go b/store/data_source.goindex 281644c2c8..a23cc6d164 100644--- a/store/data_source.go+++ b/store/data_source.go@@ -60,11 +60,11 @@ func (raw *dataSourceRaw) toDataSource() *api.DataSource {func (s *Store) CreateDataSource(ctx context.Context, create *api.DataSourceCreate) (*api.DataSource, error) {dataSourceRaw, err := s.createDataSourceRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create data source with DataSourceCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create data source with DataSourceCreate[%+v], error[%w]", create, err)}dataSource, err := s.composeDataSource(ctx, dataSourceRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose data source with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)+ return nil, fmt.Errorf("failed to compose data source with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)}return dataSource, nil}@@ -73,14 +73,14 @@ func (s *Store) CreateDataSource(ctx context.Context, create *api.DataSourceCreafunc (s *Store) GetDataSource(ctx context.Context, find *api.DataSourceFind) (*api.DataSource, error) {dataSourceRaw, err := s.getDataSourceRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get data source with DataSourceFind[%+v], error[%w]", find, err)+ return nil, fmt.Errorf("failed to get data source with DataSourceFind[%+v], error[%w]", find, err)}if dataSourceRaw == nil {return nil, nil}dataSource, err := s.composeDataSource(ctx, dataSourceRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose data source with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)+ return nil, fmt.Errorf("failed to compose data source with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)}return dataSource, nil}@@ -89,13 +89,13 @@ func (s *Store) GetDataSource(ctx context.Context, find *api.DataSourceFind) (*afunc (s *Store) FindDataSource(ctx context.Context, find *api.DataSourceFind) ([]*api.DataSource, error) {DataSourceRawList, err := s.findDataSourceRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find DataSource list, error[%w]", err)+ return nil, fmt.Errorf("failed to find DataSource list, error[%w]", err)}var DataSourceList []*api.DataSourcefor _, raw := range DataSourceRawList {DataSource, err := s.composeDataSource(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose DataSource role with dataSourceRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose DataSource role with dataSourceRaw[%+v], error[%w]", raw, err)}DataSourceList = append(DataSourceList, DataSource)}@@ -106,11 +106,11 @@ func (s *Store) FindDataSource(ctx context.Context, find *api.DataSourceFind) ([func (s *Store) PatchDataSource(ctx context.Context, patch *api.DataSourcePatch) (*api.DataSource, error) {dataSourceRaw, err := s.patchDataSourceRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch DataSource with DataSourcePatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch DataSource with DataSourcePatch[%+v], error[%w]", patch, err)}DataSource, err := s.composeDataSource(ctx, dataSourceRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose DataSource role with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)+ return nil, fmt.Errorf("failed to compose DataSource role with dataSourceRaw[%+v], error[%w]", dataSourceRaw, err)}return DataSource, nil}@@ -124,7 +124,7 @@ func (s *Store) PatchDataSource(ctx context.Context, patch *api.DataSourcePatch)func (s *Store) createDataSourceRawTx(ctx context.Context, tx *sql.Tx, create *api.DataSourceCreate) error {_, err := s.createDataSourceImpl(ctx, tx, create)if err != nil {- return fmt.Errorf("Failed to create data source with DataSourceCreate[%+v], error[%w]", create, err)+ return fmt.Errorf("failed to create data source with DataSourceCreate[%+v], error[%w]", create, err)}return nil}diff --git a/store/environment.go b/store/environment.goindex 0c1b949dfe..26da8a0c72 100644--- a/store/environment.go+++ b/store/environment.go@@ -48,11 +48,11 @@ func (raw *environmentRaw) toEnvironment() *api.Environment {func (s *Store) CreateEnvironment(ctx context.Context, create *api.EnvironmentCreate) (*api.Environment, error) {environmentRaw, err := s.createEnvironmentRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Environment with EnvironmentCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Environment with EnvironmentCreate[%+v], error[%w]", create, err)}Environment, err := s.composeEnvironment(ctx, environmentRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Environment with environmentRaw[%+v], error[%w]", environmentRaw, err)+ return nil, fmt.Errorf("failed to compose Environment with environmentRaw[%+v], error[%w]", environmentRaw, err)}return Environment, nil}@@ -61,13 +61,13 @@ func (s *Store) CreateEnvironment(ctx context.Context, create *api.EnvironmentCrfunc (s *Store) FindEnvironment(ctx context.Context, find *api.EnvironmentFind) ([]*api.Environment, error) {EnvironmentRawList, err := s.findEnvironmentRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Environment list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Environment list, error[%w]", err)}var EnvironmentList []*api.Environmentfor _, raw := range EnvironmentRawList {Environment, err := s.composeEnvironment(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Environment role with environmentRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Environment role with environmentRaw[%+v], error[%w]", raw, err)}EnvironmentList = append(EnvironmentList, Environment)}@@ -78,11 +78,11 @@ func (s *Store) FindEnvironment(ctx context.Context, find *api.EnvironmentFind)func (s *Store) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatch) (*api.Environment, error) {environmentRaw, err := s.patchEnvironmentRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Environment with EnvironmentPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Environment with EnvironmentPatch[%+v], error[%w]", patch, err)}Environment, err := s.composeEnvironment(ctx, environmentRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Environment role with environmentRaw[%+v], error[%w]", environmentRaw, err)+ return nil, fmt.Errorf("failed to compose Environment role with environmentRaw[%+v], error[%w]", environmentRaw, err)}return Environment, nil}@@ -91,7 +91,7 @@ func (s *Store) PatchEnvironment(ctx context.Context, patch *api.EnvironmentPatcfunc (s *Store) GetEnvironmentByID(ctx context.Context, id int) (*api.Environment, error) {envRaw, err := s.getEnvironmentByIDRaw(ctx, id)if err != nil {- return nil, fmt.Errorf("Failed to get environment with ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get environment with ID[%d], error[%w]", id, err)}if envRaw == nil {return nil, nil@@ -99,7 +99,7 @@ func (s *Store) GetEnvironmentByID(ctx context.Context, id int) (*api.Environmenenv, err := s.composeEnvironment(ctx, envRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose environment with environmentRaw[%+v], error[%w]", envRaw, err)+ return nil, fmt.Errorf("failed to compose environment with environmentRaw[%+v], error[%w]", envRaw, err)}return env, nildiff --git a/store/inbox.go b/store/inbox.goindex 7634c200ca..297ab73901 100644--- a/store/inbox.go+++ b/store/inbox.go@@ -36,11 +36,11 @@ func (raw *inboxRaw) toInbox() *api.Inbox {func (s *Store) CreateInbox(ctx context.Context, create *api.InboxCreate) (*api.Inbox, error) {inboxRaw, err := s.createInboxRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Inbox with InboxCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Inbox with InboxCreate[%+v], error[%w]", create, err)}inbox, err := s.composeInbox(ctx, inboxRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)}return inbox, nil}@@ -50,14 +50,14 @@ func (s *Store) GetInboxByID(ctx context.Context, id int) (*api.Inbox, error) {find := &api.InboxFind{ID: &id}inboxRaw, err := s.getInboxRawByID(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get Inbox with ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get Inbox with ID[%d], error[%w]", id, err)}if inboxRaw == nil {return nil, nil}inbox, err := s.composeInbox(ctx, inboxRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)}return inbox, nil}@@ -66,13 +66,13 @@ func (s *Store) GetInboxByID(ctx context.Context, id int) (*api.Inbox, error) {func (s *Store) FindInbox(ctx context.Context, find *api.InboxFind) ([]*api.Inbox, error) {inboxRawList, err := s.findInboxRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Inbox list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Inbox list, error[%w]", err)}var inboxList []*api.Inboxfor _, raw := range inboxRawList {inbox, err := s.composeInbox(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Inbox with inboxRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", raw, err)}inboxList = append(inboxList, inbox)}@@ -83,11 +83,11 @@ func (s *Store) FindInbox(ctx context.Context, find *api.InboxFind) ([]*api.Inbofunc (s *Store) PatchInbox(ctx context.Context, patch *api.InboxPatch) (*api.Inbox, error) {inboxRaw, err := s.patchInboxRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Inbox with InboxPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Inbox with InboxPatch[%+v], error[%w]", patch, err)}inbox, err := s.composeInbox(ctx, inboxRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)+ return nil, fmt.Errorf("failed to compose Inbox with inboxRaw[%+v], error[%w]", inboxRaw, err)}return inbox, nil}diff --git a/store/instance.go b/store/instance.goindex ae719bc936..f8c6b079fa 100644--- a/store/instance.go+++ b/store/instance.go@@ -65,11 +65,11 @@ func (raw *instanceRaw) toInstance() *api.Instance {func (s *Store) CreateInstance(ctx context.Context, create *api.InstanceCreate) (*api.Instance, error) {instanceRaw, err := s.createInstanceRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Instance with InstanceCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Instance with InstanceCreate[%+v], error[%w]", create, err)}instance, err := s.composeInstance(ctx, instanceRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)}return instance, nil}@@ -79,14 +79,14 @@ func (s *Store) GetInstanceByID(ctx context.Context, id int) (*api.Instance, errfind := &api.InstanceFind{ID: &id}instanceRaw, err := s.getInstanceRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get Instance with ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get Instance with ID[%d], error[%w]", id, err)}if instanceRaw == nil {return nil, nil}instance, err := s.composeInstance(ctx, instanceRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)}return instance, nil}@@ -95,13 +95,13 @@ func (s *Store) GetInstanceByID(ctx context.Context, id int) (*api.Instance, errfunc (s *Store) FindInstance(ctx context.Context, find *api.InstanceFind) ([]*api.Instance, error) {instanceRawList, err := s.findInstanceRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Instance list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Instance list, error[%w]", err)}var instanceList []*api.Instancefor _, raw := range instanceRawList {instance, err := s.composeInstance(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Instance with instanceRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", raw, err)}instanceList = append(instanceList, instance)}@@ -112,11 +112,11 @@ func (s *Store) FindInstance(ctx context.Context, find *api.InstanceFind) ([]*apfunc (s *Store) PatchInstance(ctx context.Context, patch *api.InstancePatch) (*api.Instance, error) {instanceRaw, err := s.patchInstanceRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Instance with InstancePatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Instance with InstancePatch[%+v], error[%w]", patch, err)}instance, err := s.composeInstance(ctx, instanceRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)+ return nil, fmt.Errorf("failed to compose Instance with instanceRaw[%+v], error[%w]", instanceRaw, err)}return instance, nil}diff --git a/store/issue_subscriber.go b/store/issue_subscriber.goindex 7722ccb3a8..8c0e02c0d9 100644--- a/store/issue_subscriber.go+++ b/store/issue_subscriber.go@@ -29,11 +29,11 @@ func (raw *issueSubscriberRaw) toIssueSubscriber() *api.IssueSubscriber {func (s *Store) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubscriberCreate) (*api.IssueSubscriber, error) {issueSubRaw, err := s.createIssueSubscriberRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create IssueSubscriber with IssueSubscriberCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create IssueSubscriber with IssueSubscriberCreate[%+v], error[%w]", create, err)}issueSub, err := s.composeIssueSubscriber(ctx, issueSubRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose IssueSubscriber with issueSubRaw[%+v], error[%w]", issueSubRaw, err)+ return nil, fmt.Errorf("failed to compose IssueSubscriber with issueSubRaw[%+v], error[%w]", issueSubRaw, err)}return issueSub, nil}@@ -42,13 +42,13 @@ func (s *Store) CreateIssueSubscriber(ctx context.Context, create *api.IssueSubsfunc (s *Store) FindIssueSubscriber(ctx context.Context, find *api.IssueSubscriberFind) ([]*api.IssueSubscriber, error) {issueSubRawList, err := s.findIssueSubscriberRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find IssueSubscriber list, error[%w]", err)+ return nil, fmt.Errorf("failed to find IssueSubscriber list, error[%w]", err)}var issueSubList []*api.IssueSubscriberfor _, raw := range issueSubRawList {issueSub, err := s.composeIssueSubscriber(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose IssueSubscriber with issueSubRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose IssueSubscriber with issueSubRaw[%+v], error[%w]", raw, err)}issueSubList = append(issueSubList, issueSub)}diff --git a/store/member.go b/store/member.goindex 16cf3dc68c..da102e0c42 100644--- a/store/member.go+++ b/store/member.go@@ -52,11 +52,11 @@ func (raw *memberRaw) ToMember() *api.Member {func (s *Store) CreateMember(ctx context.Context, create *api.MemberCreate) (*api.Member, error) {memberRaw, err := s.createMemberRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Member with MemberCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Member with MemberCreate[%+v], error[%w]", create, err)}member, err := s.composeMember(ctx, memberRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)}return member, nil}@@ -65,13 +65,13 @@ func (s *Store) CreateMember(ctx context.Context, create *api.MemberCreate) (*apfunc (s *Store) FindMember(ctx context.Context, find *api.MemberFind) ([]*api.Member, error) {memberRawList, err := s.findMemberRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Member list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Member list, error[%w]", err)}var memberList []*api.Memberfor _, raw := range memberRawList {member, err := s.composeMember(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Member with memberRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", raw, err)}memberList = append(memberList, member)}@@ -83,14 +83,14 @@ func (s *Store) GetMemberByPrincipalID(ctx context.Context, id int) (*api.Memberfind := &api.MemberFind{PrincipalID: &id}memberRaw, err := s.getMemberRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get Member with PrincipalID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get Member with PrincipalID[%d], error[%w]", id, err)}if memberRaw == nil {return nil, nil}member, err := s.composeMember(ctx, memberRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)}return member, nil}@@ -100,14 +100,14 @@ func (s *Store) GetMemberByID(ctx context.Context, id int) (*api.Member, error)find := &api.MemberFind{ID: &id}memberRaw, err := s.getMemberRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get Member with ID[%d], error[%w]", id, err)+ return nil, fmt.Errorf("failed to get Member with ID[%d], error[%w]", id, err)}if memberRaw == nil {return nil, nil}member, err := s.composeMember(ctx, memberRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)}return member, nil}@@ -116,11 +116,11 @@ func (s *Store) GetMemberByID(ctx context.Context, id int) (*api.Member, error)func (s *Store) PatchMember(ctx context.Context, patch *api.MemberPatch) (*api.Member, error) {memberRaw, err := s.patchMemberRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Member with MemberPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Member with MemberPatch[%+v], error[%w]", patch, err)}member, err := s.composeMember(ctx, memberRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)+ return nil, fmt.Errorf("failed to compose Member with memberRaw[%+v], error[%w]", memberRaw, err)}return member, nil}diff --git a/store/pg_engine.go b/store/pg_engine.goindex 44878439db..7da6ab59ec 100644--- a/store/pg_engine.go+++ b/store/pg_engine.go@@ -420,7 +420,7 @@ func getProdCutoffVersion() (semver.Version, error) {return semver.Version{}, err}if len(versions) == 0 {- return semver.Version{}, fmt.Errorf("Migration path %s has no minor version", minorPathPrefix)+ return semver.Version{}, fmt.Errorf("migration path %s has no minor version", minorPathPrefix)}minorVersion := versions[len(versions)-1]@@ -434,7 +434,7 @@ func getProdCutoffVersion() (semver.Version, error) {return semver.Version{}, err}if len(patchVersions) == 0 {- return semver.Version{}, fmt.Errorf("Migration path %s has no patch version", patchPathPrefix)+ return semver.Version{}, fmt.Errorf("migration path %s has no patch version", patchPathPrefix)}return patchVersions[len(patchVersions)-1].version, nil}diff --git a/store/policy.go b/store/policy.goindex 368081ff77..bbd540461f 100644--- a/store/policy.go+++ b/store/policy.go@@ -56,11 +56,11 @@ func (raw *policyRaw) toPolicy() *api.Policy {func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*api.Policy, error) {policyRaw, err := s.upsertPolicyRaw(ctx, upsert)if err != nil {- return nil, fmt.Errorf("Failed to upsert policy with PolicyUpsert[%+v], error[%w]", upsert, err)+ return nil, fmt.Errorf("failed to upsert policy with PolicyUpsert[%+v], error[%w]", upsert, err)}policy, err := s.composePolicy(ctx, policyRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose policy with policyRaw[%+v], error[%w]", policyRaw, err)+ return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error[%w]", policyRaw, err)}return policy, nil}@@ -69,11 +69,11 @@ func (s *Store) UpsertPolicy(ctx context.Context, upsert *api.PolicyUpsert) (*apfunc (s *Store) GetPolicy(ctx context.Context, find *api.PolicyFind) (*api.Policy, error) {policyRaw, err := s.getPolicyRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to get policy with PolicyFind[%+v], error[%w]", find, err)+ return nil, fmt.Errorf("failed to get policy with PolicyFind[%+v], error[%w]", find, err)}policy, err := s.composePolicy(ctx, policyRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose policy with policyRaw[%+v], error[%w]", policyRaw, err)+ return nil, fmt.Errorf("failed to compose policy with policyRaw[%+v], error[%w]", policyRaw, err)}return policy, nil}diff --git a/store/principal.go b/store/principal.goindex a186198814..2adba25d67 100644--- a/store/principal.go+++ b/store/principal.go@@ -55,7 +55,7 @@ func (raw *principalRaw) toPrincipal() *api.Principal {func (s *Store) CreatePrincipal(ctx context.Context, create *api.PrincipalCreate) (*api.Principal, error) {principalRaw, err := s.createPrincipalRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create Principal with PrincipalCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create Principal with PrincipalCreate[%+v], error[%w]", create, err)}// NOTE: Currently the corresponding Member object is not created yet.// YES, we are returning a Principal with empty Role field. OMG.@@ -67,13 +67,13 @@ func (s *Store) CreatePrincipal(ctx context.Context, create *api.PrincipalCreatefunc (s *Store) GetPrincipalList(ctx context.Context) ([]*api.Principal, error) {principalRawList, err := s.findPrincipalRawList(ctx)if err != nil {- return nil, fmt.Errorf("Failed to find Principal list, error[%w]", err)+ return nil, fmt.Errorf("failed to find Principal list, error[%w]", err)}var principalList []*api.Principalfor _, raw := range principalRawList {principal, err := s.composePrincipal(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose Principal role with principalRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", raw, err)}principalList = append(principalList, principal)}@@ -85,14 +85,14 @@ func (s *Store) GetPrincipalList(ctx context.Context) ([]*api.Principal, error)func (s *Store) FindPrincipal(ctx context.Context, find *api.PrincipalFind) (*api.Principal, error) {principalRaw, err := s.getPrincipalRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find Principal with PrincipalFind[%+v], error[%w]", find, err)+ return nil, fmt.Errorf("failed to find Principal with PrincipalFind[%+v], error[%w]", find, err)}if principalRaw == nil {return nil, nil}principal, err := s.composePrincipal(ctx, principalRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)}return principal, nil}@@ -101,11 +101,11 @@ func (s *Store) FindPrincipal(ctx context.Context, find *api.PrincipalFind) (*apfunc (s *Store) PatchPrincipal(ctx context.Context, patch *api.PrincipalPatch) (*api.Principal, error) {principalRaw, err := s.patchPrincipalRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch Principal with PrincipalPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch Principal with PrincipalPatch[%+v], error[%w]", patch, err)}principal, err := s.composePrincipal(ctx, principalRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)}return principal, nil}@@ -125,7 +125,7 @@ func (s *Store) GetPrincipalByID(ctx context.Context, id int) (*api.Principal, eprincipal, err := s.composePrincipal(ctx, principalRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)+ return nil, fmt.Errorf("failed to compose Principal role with principalRaw[%+v], error[%w]", principalRaw, err)}return principal, nil@@ -261,7 +261,7 @@ func (s *Store) composePrincipal(ctx context.Context, raw *principalRaw) (*api.Pzap.Int("id", principal.ID),zap.String("name", principal.Name),)- return nil, fmt.Errorf("Member with PrincipalID[%d] not exist, error[%w]", principal.ID, err)+ return nil, fmt.Errorf("member with PrincipalID[%d] not exist, error[%w]", principal.ID, err)}principal.Role = memberRaw.Role}diff --git a/store/task_check_run.go b/store/task_check_run.goindex 3a6bfd2a77..5b045c61c7 100644--- a/store/task_check_run.go+++ b/store/task_check_run.go@@ -54,11 +54,10 @@ func (s *TaskCheckRunService) CreateTaskCheckRunIfNeeded(ctx context.Context, crrunningCount := 0if create.SkipIfAlreadyTerminated {for _, taskCheckRun := range taskCheckRunList {- if taskCheckRun.Status == api.TaskCheckRunDone ||- taskCheckRun.Status == api.TaskCheckRunFailed ||- taskCheckRun.Status == api.TaskCheckRunCanceled {+ switch taskCheckRun.Status {+ case api.TaskCheckRunDone, api.TaskCheckRunFailed, api.TaskCheckRunCanceled:return taskCheckRun, nil- } else if taskCheckRun.Status == api.TaskCheckRunRunning {+ case api.TaskCheckRunRunning:runningCount++}}diff --git a/store/vcs.go b/store/vcs.goindex ac50bbf375..1a45a16d2a 100644--- a/store/vcs.go+++ b/store/vcs.go@@ -55,11 +55,11 @@ func (raw *vcsRaw) toVCS() *api.VCS {func (s *Store) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCS, error) {vcsRaw, err := s.createVCSRaw(ctx, create)if err != nil {- return nil, fmt.Errorf("Failed to create VCS with VCSCreate[%+v], error[%w]", create, err)+ return nil, fmt.Errorf("failed to create VCS with VCSCreate[%+v], error[%w]", create, err)}vcs, err := s.composeVCS(ctx, vcsRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose VCS with vcsRaw[%+v], error[%w]", vcsRaw, err)+ return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error[%w]", vcsRaw, err)}return vcs, nil}@@ -68,13 +68,13 @@ func (s *Store) CreateVCS(ctx context.Context, create *api.VCSCreate) (*api.VCS,func (s *Store) FindVCS(ctx context.Context, find *api.VCSFind) ([]*api.VCS, error) {vcsRawList, err := s.findVCSRaw(ctx, find)if err != nil {- return nil, fmt.Errorf("Failed to find VCS list, error[%w]", err)+ return nil, fmt.Errorf("failed to find VCS list, error[%w]", err)}var vcsList []*api.VCSfor _, raw := range vcsRawList {vcs, err := s.composeVCS(ctx, raw)if err != nil {- return nil, fmt.Errorf("Failed to compose VCS with vcsRaw[%+v], error[%w]", raw, err)+ return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error[%w]", raw, err)}vcsList = append(vcsList, vcs)}@@ -102,11 +102,11 @@ func (s *Store) GetVCSByID(ctx context.Context, id int) (*api.VCS, error) {func (s *Store) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCS, error) {vcsRaw, err := s.patchVCSRaw(ctx, patch)if err != nil {- return nil, fmt.Errorf("Failed to patch VCS with VCSPatch[%+v], error[%w]", patch, err)+ return nil, fmt.Errorf("failed to patch VCS with VCSPatch[%+v], error[%w]", patch, err)}vcs, err := s.composeVCS(ctx, vcsRaw)if err != nil {- return nil, fmt.Errorf("Failed to compose VCS with vcsRaw[%+v], error[%w]", vcsRaw, err)+ return nil, fmt.Errorf("failed to compose VCS with vcsRaw[%+v], error[%w]", vcsRaw, err)}return vcs, nil}@@ -114,7 +114,7 @@ func (s *Store) PatchVCS(ctx context.Context, patch *api.VCSPatch) (*api.VCS, er// DeleteVCS deletes an instance of VCSfunc (s *Store) DeleteVCS(ctx context.Context, delete *api.VCSDelete) error {if err := s.deleteVCSRaw(ctx, delete); err != nil {- return fmt.Errorf("Failed to delete VCS with VCSDelete[%+v], error[%w]", delete, err)+ return fmt.Errorf("failed to delete VCS with VCSDelete[%+v], error[%w]", delete, err)}return nil}