Skip to content

Commit 200dcd1

Browse files
committed
Use golangci instead of govet
1 parent 7279756 commit 200dcd1

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

.golangci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
version: "2"
2+
3+
issues:
4+
max-same-issues: 50
5+
6+
formatters:
7+
enable:
8+
- goimports
9+
10+
settings:
11+
goimports:
12+
local-prefixes:
13+
- github.com/gocql/gocql
14+
- github.com/apache/cassandra-gocql-driver
15+
golines:
16+
max-len: 120
17+
18+
linters:
19+
default: none
20+
enable:
21+
- nolintlint
22+
- govet
23+
settings:
24+
govet:
25+
enable-all: true
26+
disable:
27+
- shadow
28+
- fieldalignment
29+
30+
nolintlint:
31+
allow-no-explanation: [ golines ]
32+
require-explanation: true
33+
require-specific: true

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ TEST_COMPRESSOR ?= no-compression
88
TEST_INTEGRATION_TAGS ?= integration
99

1010
CCM_VERSION ?= 39b8222b31a6c7afe8fe845d16981088a5a735ad
11+
GOLANGCI_VERSION = v2.1.6
1112
JVM_EXTRA_OPTS ?= -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler
1213
ifeq (${CCM_CONFIG_DIR},)
1314
CCM_CONFIG_DIR = ~/.ccm
@@ -101,9 +102,15 @@ test-unit:
101102
@go clean -testcache
102103
go test -tags unit -timeout=5m -race ./...
103104

104-
check:
105-
@echo "Run go vet linter"
106-
go vet --tags "unit all cassandra integration" ./...
105+
check: .prepare-golangci
106+
@echo "Build"
107+
@go build -tags all .
108+
@echo "Check linting"
109+
@golangci-lint run
110+
111+
fix: .prepare-golangci
112+
@echo "Fix linting"
113+
golangci-lint run --fix
107114

108115
.prepare-java:
109116
ifeq ($(shell if [ -f ~/.sdkman/bin/sdkman-init.sh ]; then echo "installed"; else echo "not-installed"; fi), not-installed)
@@ -149,3 +156,9 @@ install-ccm:
149156
@mkdir ${CCM_CONFIG_DIR} 2>/dev/null 1>&2 || true
150157
@echo ${CCM_VERSION} > ${CCM_CONFIG_DIR}/ccm-version
151158

159+
.prepare-golangci:
160+
@if ! golangci-lint --version 2>/dev/null | grep ${GOLANGCI_VERSION} >/dev/null; then \
161+
echo "Installing golangci-ling ${GOLANGCI_VERSION}"; \
162+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${GOLANGCI_VERSION}; \
163+
fi
164+

0 commit comments

Comments
 (0)