File tree Expand file tree Collapse file tree 3 files changed +143
-0
lines changed Expand file tree Collapse file tree 3 files changed +143
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Lint the entire golang project. This workflow relies on the
2
+ # '.golangci.yml' file for its configuration settings.
3
+ name : Lint
4
+ on :
5
+ push :
6
+ tags :
7
+ - v*
8
+ branches :
9
+ - master
10
+ - main
11
+ pull_request :
12
+
13
+ permissions :
14
+ contents : read
15
+
16
+ jobs :
17
+ golangci :
18
+ name : golangci-lint
19
+ runs-on : ubuntu-latest
20
+ steps :
21
+ - uses : actions/setup-go@v5
22
+ with :
23
+ go-version : ' 1.21'
24
+
25
+ - uses : actions/checkout@v4
26
+
27
+ - name : golangci-lint
28
+
29
+ with :
30
+ version : v1.57.2
31
+ args : --timeout 15m
Original file line number Diff line number Diff line change
1
+ run :
2
+ timeout : 10m
3
+ tests : true
4
+
5
+ # These linter checks can be modified on a per project basis.
6
+ # Simply remove them from the enable list to disable them.
7
+ linters :
8
+ disable-all : true
9
+ enable :
10
+ - asciicheck
11
+ - bidichk
12
+ - bodyclose
13
+ - decorder
14
+ - dupl
15
+ - dupword
16
+ - errcheck
17
+ - errchkjson
18
+ - errname
19
+ - exhaustive
20
+ - exportloopref
21
+ - forbidigo
22
+ - gci
23
+ - goconst
24
+ - gocritic
25
+ - godot
26
+ - gofumpt
27
+ - gosec
28
+ - gosimple
29
+ - gosmopolitan
30
+ - govet
31
+ - grouper
32
+ - ineffassign
33
+ - loggercheck
34
+ - misspell
35
+ - nilerr
36
+ - nilnil
37
+ - noctx
38
+ - staticcheck
39
+ - stylecheck
40
+ - testifylint
41
+ - thelper
42
+ - tparallel
43
+ - typecheck
44
+ - unconvert
45
+ - unparam
46
+ - unused
47
+ - usestdlibvars
48
+ - wastedassign
49
+ - whitespace
50
+
51
+ linters-settings :
52
+ gci :
53
+ custom-order : true
54
+ sections :
55
+ - standard # Standard section: captures all standard packages.
56
+ - default # Default section: contains all imports that could not be matched to another section type.
57
+ - blank # blank imports
58
+ - dot # dot imports
59
+ - prefix(cosmossdk.io)
60
+ - prefix(github.com/cosmos)
61
+ - prefix(github.com/cosmos/cosmos-sdk)
62
+ - prefix(github.com/cometbft/cometbft)
63
+ # TODO: Replace below with '- prefix(<project-package-name>)'
64
+ - prefix(github.com/strangelove-ventures/oss-repo-template)
65
+ gosec :
66
+ excludes :
67
+ - G404 # disables checks on insecure random number source
68
+
69
+ issues :
70
+ max-issues-per-linter : 0
Original file line number Diff line number Diff line change
1
+ golangci_lint_cmd =golangci-lint
2
+ golangci_version =v1.57.2
3
+ gofumpt_cmd =gofumpt
4
+ gofumpt_version =v0.6.0
5
+
6
+ default : help
7
+
8
+ .PHONY : help
9
+ # # help: Prints this help message
10
+ help : Makefile
11
+ @echo
12
+ @echo " Available make commands:"
13
+ @echo
14
+ @sed -n ' s/^##//p' $< | column -t -s ' :' | sed -e ' s/^/ /'
15
+ @echo
16
+
17
+ .PHONY : lint
18
+ # # lint: Lint the repository
19
+ lint :
20
+ @echo " --> Running linter"
21
+ @if ! $(golangci_lint_cmd ) --version 2> /dev/null | grep -q $(golangci_version ) ; then \
22
+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version); \
23
+ fi
24
+ @$(golangci_lint_cmd) run ./... --timeout 15m
25
+
26
+ .PHONY : lint-fix
27
+ # # lint-fix: Lint the repository and fix warnings (if applicable)
28
+ lint-fix :
29
+ @echo " --> Running linter and fixing issues"
30
+ @if ! $(golangci_lint_cmd ) --version 2> /dev/null | grep -q $(golangci_version ) ; then \
31
+ go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version ) ; \
32
+ fi
33
+ @$(golangci_lint_cmd ) run ./... --fix --timeout 15m
34
+
35
+ .PHONY : gofumpt
36
+ # # gofumpt: Format the code with gofumpt
37
+ gofumpt :
38
+ @echo " --> Running gofumpt"
39
+ @if ! $(gofumpt_cmd ) -version 2> /dev/null | grep -q $(gofumpt_version ) ; then \
40
+ go install mvdan.cc/gofumpt@$(gofumpt_version ) ; \
41
+ fi
42
+ @gofumpt -l -w .
You can’t perform that action at this time.
0 commit comments