Skip to content

Commit 27b9a78

Browse files
committed
chore: upgrade golangci-lint and pre-commit from template
1 parent 5879667 commit 27b9a78

File tree

3 files changed

+67
-4
lines changed

3 files changed

+67
-4
lines changed

.golangci.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# ----------------------------------------------------------------------------------------------------------------------
2+
# GOLANG LINTER RULES
3+
# ----------------------------------------------------------------------------------------------------------------------
4+
5+
# configure golangci-lint
6+
# see https://github.com/golangci/golangci-lint/blob/master/.golangci.example.yml
7+
issues:
8+
exclude-rules:
9+
- path: _test\.go
10+
linters:
11+
- dupl
12+
- gosec
13+
- goconst
14+
linters:
15+
enable:
16+
- bodyclose
17+
- deadcode
18+
- depguard
19+
- dupl
20+
- errcheck
21+
- gocritic
22+
- gofmt
23+
- goconst
24+
- goimports
25+
- gosec
26+
- gosimple
27+
- revive
28+
- govet
29+
- ineffassign
30+
- interfacer
31+
- misspell
32+
- nakedret
33+
- prealloc
34+
- staticcheck
35+
- structcheck
36+
- stylecheck
37+
- typecheck
38+
- unconvert
39+
- unparam
40+
- unused
41+
- varcheck
42+
- whitespace
43+
44+
linters-settings:
45+
errcheck:
46+
# report about assignment of errors to blank identifier: `num, _ := strcnv.Atoi(numStr)`;
47+
# default is false: such cases aren't reported by default.
48+
check-blank: true
49+
ignore: fmt:.*,[rR]ead|[wW]rite|[cC]lose,io:Copy
50+
govet:
51+
# report about shadowed variables
52+
check-shadowing: true
53+
gocyclo:
54+
# minimal code complexity to report, 30 by default
55+
min-complexity: 15
56+
maligned:
57+
# print struct with more effective memory layout or not, false by default
58+
suggest-new: true
59+
gofmt:
60+
# simplify code: gofmt with `-s` option, true by default
61+
simplify: true

.pre-commit-config.yaml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
repos:
22
- repo: https://github.com/mineiros-io/pre-commit-hooks
3-
rev: v0.2.3
3+
rev: v0.3.0
44
hooks:
55
- id: terraform-fmt
66
- id: terraform-validate
77
exclude: ^examples|.terraform/
88
- id: tflint
9-
- id: gofmt
10-
- id: goimports
119
- id: golangci-lint
1210
- id: phony-targets
1311
- id: markdown-link-check

Makefile

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Set default shell to bash
22
SHELL := /bin/bash -o pipefail
33

4-
BUILD_TOOLS_VERSION ?= v0.12.0
4+
BUILD_TOOLS_VERSION ?= v0.13.0
55
BUILD_TOOLS_DOCKER_REPO ?= mineiros/build-tools
66
BUILD_TOOLS_DOCKER_IMAGE ?= ${BUILD_TOOLS_DOCKER_REPO}:${BUILD_TOOLS_VERSION}
77

@@ -36,6 +36,10 @@ GIT_TOPLEVEl = $(shell git rev-parse --show-toplevel)
3636
DOCKER_RUN_FLAGS += -v ${GIT_TOPLEVEl}:/build
3737
DOCKER_RUN_FLAGS += --rm
3838
DOCKER_RUN_FLAGS += -e TF_IN_AUTOMATION
39+
# If TF_VERSION is defined, TFSwitch will switch to the desired version on
40+
# container startup. If TF_VERSION is omitted, the default version installed
41+
# inside the docker image will be used.
42+
DOCKER_RUN_FLAGS += -e TF_VERSION
3943

4044
# If SSH_AUTH_SOCK is set, we forward the SSH agent of the host system into
4145
# the docker container. This is useful when working with private repositories

0 commit comments

Comments
 (0)