Skip to content

Commit ffacc91

Browse files
authored
Merge pull request #20 from utilitywarehouse/master-mirror
Revive project: update Go version & linter
2 parents fdbd8db + bb0867c commit ffacc91

File tree

5 files changed

+187
-217
lines changed

5 files changed

+187
-217
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout
11-
uses: actions/checkout@v2
12-
- uses: utilitywarehouse/actions-go/setup@main
11+
uses: actions/checkout@v4
12+
- uses: actions/setup-go@v5
1313
with:
14-
go-version: '^1.20'
14+
go-version-file: "go.mod"
1515
- name: Lint
1616
uses: magefile/mage-action@v1
1717
with:
@@ -21,10 +21,10 @@ jobs:
2121
test:
2222
runs-on: ubuntu-latest
2323
steps:
24-
- uses: actions/checkout@v2
25-
- uses: utilitywarehouse/actions-go/setup@main
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-go@v5
2626
with:
27-
go-version: '^1.20'
27+
go-version-file: "go.mod"
2828
- name: test
2929
uses: magefile/mage-action@v1
3030
with:

.golangci.yml

Lines changed: 79 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,84 @@
1-
# options for analysis running
1+
version: "2"
22
run:
3-
deadline: 20s
43
tests: true
5-
skip-dirs:
6-
- generated
7-
skip-files:
8-
- ".*\\.pb\\.go"
9-
silent: true
10-
11-
# output configuration options
12-
output:
13-
format: colored-line-number
14-
print-issued-lines: true
15-
print-linter-name: true
16-
17-
# all available settings of specific linters
18-
linters-settings:
19-
errcheck:
20-
check-type-assertions: true
21-
check-blank: true
22-
govet:
23-
check-shadowing: false
24-
disable:
25-
- shadow
26-
gofmt:
27-
simplify: true
28-
goconst:
29-
min-len: 3
30-
min-occurrences: 3
31-
misspell:
32-
locale: UK
33-
ignore-words:
34-
- statuser
35-
unused:
36-
check-exported: true
37-
unparam:
38-
algo: cha
39-
nakedret:
40-
max-func-lines: 30
41-
prealloc:
42-
simple: true
43-
range-loops: true
44-
for-loops: true
45-
464
linters:
475
enable:
48-
- golint # Golint differs from gofmt. Gofmt reformats Go source code, whereas golint prints out style mistakes [fast: true]
49-
- misspell # Finds commonly misspelled English words in comments [fast: true]
50-
- nakedret # Finds naked returns in functions greater than a specified function length [fast: true]
51-
- errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases [fast: false]
52-
- gas # Inspects source code for security problems [fast: false]
53-
- structcheck # Finds an unused struct fields [fast: false]
54-
- unconvert # Remove unnecessary type conversions [fast: false]
55-
- unparam # Reports unused function parameters [fast: false]
56-
- goimports # Goimports does everything that gofmt does. Additionally it checks unused imports [fast: true]
57-
- lll # Reports long lines [fast: true]
58-
- megacheck # 3 sub-linters in one: unused, gosimple and staticcheck [fast: false]
59-
6+
- gosec
7+
- lll
8+
- misspell
9+
- nakedret
10+
- unconvert
11+
- unparam
6012
disable:
61-
- staticcheck # (megacheck) Staticcheck is a go vet on steroids, applying a ton of static analysis checks [fast: false]
62-
- prealloc # Finds slice declarations that could potentially be preallocated [fast: true]
63-
- unused # (megacheck) Checks Go code for unused constants, variables, functions and types [fast: false]
64-
- gosimple # (megacheck) Linter for Go source code that specializes in simplifying a code [fast: false]
65-
- gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification [fast: true]
66-
- dupl # Tool for code clone detection [fast: true]
67-
- typecheck # Like the front-end of a Go compiler, parses and type-checks Go code [fast: false]
68-
- depguard # Go linter that checks if package imports are in a list of acceptable packages [fast: false]
69-
- varcheck # Finds unused global variables and constants [fast: false]
70-
- deadcode # Finds unused code [fast: false]
71-
- goconst # Finds repeated strings that could be replaced by a constant [fast: true]
72-
- gocyclo # Computes and checks the cyclomatic complexity of functions [fast: true]
73-
- maligned # Tool to detect Go structs that would take less memory if their fields were sorted [fast: false]
74-
75-
issues:
76-
exclude-use-default: false
77-
exclude-rules:
78-
- linters:
79-
- lll
80-
source: "github.com/utilitywarehouse/ordering-platform"
81-
exclude:
82-
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
83-
- Error return value of
84-
.((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv|.*Disconnect).
85-
is not checked
86-
87-
# golint: Exported variables are rarely used and generally reserved for errors which should be self explanitory
88-
- exported var \w+ should have comment or be unexported
89-
90-
# golint: False positive when tests are defined in package 'test'
91-
- func name will be used as test\.Test.* by other packages, and that
92-
stutters; consider calling this
93-
94-
# gas: Too many false-positives on 'unsafe' usage
95-
- Use of unsafe calls should be audited
96-
97-
# gas: Too many false-positives for parametrized shell calls
98-
- Subprocess launch(ed with variable|ing should be audited)
99-
100-
# gas: Duplicated errcheck checks
101-
- G104
102-
103-
# gas: Too many issues in popular repos
104-
- (Expect directory permissions to be 0750 or less|Expect file permissions
105-
to be 0600 or less)
106-
107-
# gas: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
108-
- Potential file inclusion via variable
109-
110-
# govet: Common false positives
111-
- (possible misuse of unsafe.Pointer|should have signature)
112-
113-
# megacheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
114-
- ineffective break statement. Did you mean to break out of the outer loop
115-
116-
# disable comments
117-
- exported [a-z]+ `?[^ ]+ should have comment
13+
- depguard
14+
- dupl
15+
- goconst
16+
- gocyclo
17+
- prealloc
18+
- staticcheck
19+
- unused
20+
settings:
21+
errcheck:
22+
check-type-assertions: true
23+
check-blank: true
24+
goconst:
25+
min-len: 3
26+
min-occurrences: 3
27+
govet:
28+
disable:
29+
- shadow
30+
misspell:
31+
locale: UK
32+
ignore-rules:
33+
- statuser
34+
nakedret:
35+
max-func-lines: 30
36+
prealloc:
37+
simple: true
38+
range-loops: true
39+
for-loops: true
40+
exclusions:
41+
generated: lax
42+
rules:
43+
- linters:
44+
- lll
45+
source: github.com/utilitywarehouse/ordering-platform
46+
- path: (.+)\.go$
47+
text: Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv|.*Disconnect). is not checked
48+
- path: (.+)\.go$
49+
text: exported var \w+ should have comment or be unexported
50+
- path: (.+)\.go$
51+
text: func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
52+
- path: (.+)\.go$
53+
text: Use of unsafe calls should be audited
54+
- path: (.+)\.go$
55+
text: Subprocess launch(ed with variable|ing should be audited)
56+
- path: (.+)\.go$
57+
text: G104
58+
- path: (.+)\.go$
59+
text: (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
60+
- path: (.+)\.go$
61+
text: Potential file inclusion via variable
62+
- path: (.+)\.go$
63+
text: (possible misuse of unsafe.Pointer|should have signature)
64+
- path: (.+)\.go$
65+
text: ineffective break statement. Did you mean to break out of the outer loop
66+
- path: (.+)\.go$
67+
text: exported [a-z]+ `?[^ ]+ should have comment
68+
paths:
69+
- third_party$
70+
- builtin$
71+
- examples$
72+
formatters:
73+
enable:
74+
- goimports
75+
settings:
76+
gofmt:
77+
simplify: true
78+
exclusions:
79+
generated: lax
80+
paths:
81+
- third_party$
82+
- builtin$
83+
- examples$
84+
- generated$

go.mod

Lines changed: 23 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,36 @@
11
module github.com/utilitywarehouse/patrol
22

3-
go 1.20
3+
go 1.25.5
44

55
require (
6-
github.com/go-git/go-git/v5 v5.4.2
7-
github.com/magefile/mage v1.11.0
8-
github.com/stretchr/testify v1.7.0
9-
golang.org/x/mod v0.12.0
6+
github.com/go-git/go-git/v5 v5.16.4
7+
github.com/magefile/mage v1.15.0
8+
github.com/stretchr/testify v1.11.1
9+
golang.org/x/mod v0.31.0
1010
)
1111

1212
require (
13-
github.com/Microsoft/go-winio v0.4.16 // indirect
14-
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
15-
github.com/acomagu/bufpipe v1.0.3 // indirect
13+
dario.cat/mergo v1.0.2 // indirect
14+
github.com/Microsoft/go-winio v0.6.2 // indirect
15+
github.com/ProtonMail/go-crypto v1.3.0 // indirect
16+
github.com/cloudflare/circl v1.6.2 // indirect
17+
github.com/cyphar/filepath-securejoin v0.6.1 // indirect
1618
github.com/davecgh/go-spew v1.1.1 // indirect
17-
github.com/emirpasic/gods v1.12.0 // indirect
18-
github.com/go-git/gcfg v1.5.0 // indirect
19-
github.com/go-git/go-billy/v5 v5.3.1 // indirect
20-
github.com/imdario/mergo v0.3.12 // indirect
19+
github.com/emirpasic/gods v1.18.1 // indirect
20+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
21+
github.com/go-git/go-billy/v5 v5.7.0 // indirect
22+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
2123
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
22-
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
23-
github.com/mitchellh/go-homedir v1.1.0 // indirect
24+
github.com/kevinburke/ssh_config v1.4.0 // indirect
25+
github.com/klauspost/cpuid/v2 v2.3.0 // indirect
26+
github.com/pjbgf/sha1cd v0.5.0 // indirect
2427
github.com/pmezard/go-difflib v1.0.0 // indirect
25-
github.com/sergi/go-diff v1.1.0 // indirect
26-
github.com/xanzy/ssh-agent v0.3.0 // indirect
27-
golang.org/x/crypto v0.13.0 // indirect
28-
golang.org/x/net v0.15.0 // indirect
29-
golang.org/x/sys v0.12.0 // indirect
28+
github.com/sergi/go-diff v1.4.0 // indirect
29+
github.com/skeema/knownhosts v1.3.2 // indirect
30+
github.com/xanzy/ssh-agent v0.3.3 // indirect
31+
golang.org/x/crypto v0.46.0 // indirect
32+
golang.org/x/net v0.48.0 // indirect
33+
golang.org/x/sys v0.39.0 // indirect
3034
gopkg.in/warnings.v0 v0.1.2 // indirect
3135
gopkg.in/yaml.v3 v3.0.1 // indirect
3236
)

0 commit comments

Comments
 (0)