From 00cc64029a47e501b843af10ca8c4c9ed6942da9 Mon Sep 17 00:00:00 2001 From: Abhinav Singh Date: Fri, 20 Oct 2023 15:30:32 -0700 Subject: [PATCH] MISC: Fix go lint issues --- app/store/database/code_comment.go | 1 + app/store/database/connector.go | 1 + app/store/database/execution.go | 1 + app/store/database/principal.go | 1 + gitrpc/internal/service/ref.go | 1 + gitrpc/internal/service/shared_repo.go | 3 +-- 6 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/store/database/code_comment.go b/app/store/database/code_comment.go index b13c569d8..d11133a3e 100644 --- a/app/store/database/code_comment.go +++ b/app/store/database/code_comment.go @@ -135,6 +135,7 @@ func (s *CodeCommentView) UpdateAll(ctx context.Context, codeComments []*types.C db := dbtx.GetAccessor(ctx, s.db) + //nolint:sqlclosecheck stmt, err := db.PrepareNamedContext(ctx, sqlQuery) if err != nil { return database.ProcessSQLErrorf(err, "Failed to prepare update statement for update code comments") diff --git a/app/store/database/connector.go b/app/store/database/connector.go index 5ab8bed5f..9fb0a6348 100644 --- a/app/store/database/connector.go +++ b/app/store/database/connector.go @@ -33,6 +33,7 @@ import ( var _ store.ConnectorStore = (*connectorStore)(nil) const ( + //nolint:goconst connectorQueryBase = ` SELECT` + connectorColumns + ` FROM connectors` diff --git a/app/store/database/execution.go b/app/store/database/execution.go index 674d8704e..d15704fee 100644 --- a/app/store/database/execution.go +++ b/app/store/database/execution.go @@ -127,6 +127,7 @@ const ( // Find returns an execution given an execution ID. func (s *executionStore) Find(ctx context.Context, id int64) (*types.Execution, error) { + //nolint:goconst const findQueryStmt = ` SELECT` + executionColumns + ` FROM executions diff --git a/app/store/database/principal.go b/app/store/database/principal.go index d48231b0e..ce00564e9 100644 --- a/app/store/database/principal.go +++ b/app/store/database/principal.go @@ -72,6 +72,7 @@ const principalCommonColumns = ` const principalColumns = principalCommonColumns + ` ,principal_type` +//nolint:goconst const principalSelectBase = ` SELECT` + principalColumns + ` FROM principals` diff --git a/gitrpc/internal/service/ref.go b/gitrpc/internal/service/ref.go index 32eeb900c..0f1d341f4 100644 --- a/gitrpc/internal/service/ref.go +++ b/gitrpc/internal/service/ref.go @@ -115,6 +115,7 @@ func createReferenceWalkPatternsFromQuery(basePath string, query string) []strin } // suffix only match (refs/tags/**/*QUERY) + //nolint:goconst return []string{basePath + "**/*" + query} } diff --git a/gitrpc/internal/service/shared_repo.go b/gitrpc/internal/service/shared_repo.go index b3b2847c2..b49f36b4d 100644 --- a/gitrpc/internal/service/shared_repo.go +++ b/gitrpc/internal/service/shared_repo.go @@ -81,9 +81,8 @@ func (r *SharedRepo) Clone(ctx context.Context, branchName string) error { } } else if matched, _ = regexp.MatchString(".* repository .* does not exist.*", stderr); matched { return fmt.Errorf("%s %w", r.repoUID, types.ErrNotFound) - } else { - return fmt.Errorf("Clone: %w %s", err, stderr) } + return fmt.Errorf("Clone: %w %s", err, stderr) } gitRepo, err := git.OpenRepository(ctx, r.tmpPath) if err != nil {