diff options
author | karthik nayak <knayak@gitlab.com> | 2022-10-10 17:33:47 +0300 |
---|---|---|
committer | karthik nayak <knayak@gitlab.com> | 2022-10-10 17:33:47 +0300 |
commit | a3a94460be05799fdb5f9b4d1dab7832fe556bcd (patch) | |
tree | b397054876fffc6d532a44f4e80509f264a28beb | |
parent | cc9fe2bf1bce969be9d9616a67c386f0a7fc9b25 (diff) | |
parent | 58fe50f7aeedd388d8990f2835cf42f485bebf21 (diff) |
Merge branch 'lint-fixes' into 'master'
Makefile: Add `lint-fix` command
See merge request https://gitlab.com/gitlab-org/gitaly/-/merge_requests/4900
Merged-by: karthik nayak <knayak@gitlab.com>
Approved-by: John Cai <jcai@gitlab.com>
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | auth/token.go | 2 | ||||
-rw-r--r-- | internal/middleware/featureflag/featureflag_handler_test.go | 4 | ||||
-rw-r--r-- | internal/praefect/service/checks.go | 2 |
4 files changed, 9 insertions, 4 deletions
@@ -442,6 +442,11 @@ check-mod-tidy: lint: ${GOLANGCI_LINT} libgit2 ${GITALY_PACKED_EXECUTABLES} ${Q}${GOLANGCI_LINT} run --build-tags "${SERVER_BUILD_TAGS},${GIT2GO_BUILD_TAGS}" --out-format tab --config ${GOLANGCI_LINT_CONFIG} ${GOLANGCI_LINT_OPTIONS} +.PHONY: lint-fix +## Run Go linter and write back fixes to the files (not supported by all linters). +lint-fix: ${GOLANGCI_LINT} libgit2 ${GITALY_PACKED_EXECUTABLES} + ${Q}${GOLANGCI_LINT} run --fix --build-tags "${SERVER_BUILD_TAGS},${GIT2GO_BUILD_TAGS}" --out-format tab --config ${GOLANGCI_LINT_CONFIG} ${GOLANGCI_LINT_OPTIONS} + .PHONY: format ## Run Go formatter and adjust imports. format: ${GOIMPORTS} ${GOFUMPT} diff --git a/auth/token.go b/auth/token.go index d38f3ccee..7a32b8c78 100644 --- a/auth/token.go +++ b/auth/token.go @@ -18,7 +18,7 @@ import ( ) var ( - //nolint: gochecknoglobals + //nolint:gochecknoglobals // This infrastructure is required for testing purposes and there is no // proper place to put it instead. While we could move it into the // config, we certainly don't want to make it configurable for now, so diff --git a/internal/middleware/featureflag/featureflag_handler_test.go b/internal/middleware/featureflag/featureflag_handler_test.go index 8d1a4ec8f..649506cc8 100644 --- a/internal/middleware/featureflag/featureflag_handler_test.go +++ b/internal/middleware/featureflag/featureflag_handler_test.go @@ -47,7 +47,7 @@ func TestStreamInterceptor(t *testing.T) { } func callUnary(ctx context.Context) { - //nolint: errcheck + //nolint:errcheck UnaryInterceptor(ctx, nil, nil, func(context.Context, interface{}) (interface{}, error) { ctxlogrus.Extract(ctx).Info("verify") return nil, nil @@ -55,7 +55,7 @@ func callUnary(ctx context.Context) { } func callStream(ctx context.Context) { - //nolint: errcheck + //nolint:errcheck StreamInterceptor(ctx, &grpcmw.WrappedServerStream{WrappedContext: ctx}, nil, func(interface{}, grpc.ServerStream) error { ctxlogrus.Extract(ctx).Info("verify") return nil diff --git a/internal/praefect/service/checks.go b/internal/praefect/service/checks.go index 52411f318..9bf5e7bb0 100644 --- a/internal/praefect/service/checks.go +++ b/internal/praefect/service/checks.go @@ -130,7 +130,7 @@ func NewPostgresReadWriteCheck(conf config.Config, w io.Writer, quiet bool) *Che if err != nil { return fmt.Errorf("error starting transaction: %w", err) } - //nolint: errcheck + //nolint:errcheck defer tx.Rollback() var id int |