Skip to content

Commit eda03af

Browse files
committed
Add lefthook support and make lint target
1 parent d67a26d commit eda03af

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ cover.out
1919
cover.xml
2020
custom_hooks
2121
hooks/*.d
22+
/support/bin/golangci-*
2223
/support/bin/gotestsum-*
2324
tags
2425
tmp/*

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang test_fancy test_golang_fancy coverage coverage_golang setup _script_install build compile check clean install
1+
.PHONY: validate verify verify_ruby verify_golang test test_ruby test_golang test_fancy test_golang_fancy coverage coverage_golang setup _script_install build compile check clean install lint
22

33
FIPS_MODE ?= 0
44
OS := $(shell uname | tr A-Z a-z)
@@ -10,6 +10,9 @@ BUILD_TAGS := tracer_static tracer_static_jaeger continuous_profiler_stackdriver
1010
GOTESTSUM_VERSION := 1.10.0
1111
GOTESTSUM_FILE := support/bin/gotestsum-${GOTESTSUM_VERSION}
1212

13+
GOLANGCI_LINT_VERSION := 1.54.2
14+
GOLANGCI_LINT_FILE := support/bin/golangci-lint-${GOLANGCI_LINT_VERSION}
15+
1316
export GOFLAGS := -mod=readonly
1417

1518
ifeq (${FIPS_MODE}, 1)
@@ -75,6 +78,13 @@ coverage: coverage_golang
7578
coverage_golang:
7679
[ -f cover.out ] && go tool cover -func cover.out
7780

81+
lint: ${GOLANGCI_LINT_FILE}
82+
${GOLANGCI_LINT_FILE} run --issues-exit-code 0 --print-issued-lines=false
83+
84+
${GOLANGCI_LINT_FILE}:
85+
mkdir -p $(shell dirname ${GOLANGCI_LINT_FILE})
86+
curl -L https://github.com/golangci/golangci-lint/releases/download/v${GOLANGCI_LINT_VERSION}/golangci-lint-${GOLANGCI_LINT_VERSION}-${OS}-amd64.tar.gz | tar --strip-components 1 -zOxf - golangci-lint-${GOLANGCI_LINT_VERSION}-${OS}-amd64/golangci-lint > ${GOLANGCI_LINT_FILE} && chmod +x ${GOLANGCI_LINT_FILE}
87+
7888
setup: _script_install bin/gitlab-shell
7989

8090
_script_install:

lefthook.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
pre-push:
2+
commands:
3+
test:
4+
run: make test
5+
# Disabled for now as there's _lots_ of linter errors
6+
#lint:
7+
# run: make lint

0 commit comments

Comments
 (0)