Skip to content

Commit de0f077

Browse files
committed
chore(deps): fix lint and update deps and comments (#45)
1 parent 5c68b04 commit de0f077

18 files changed

+209
-246
lines changed

.github/workflows/ci-workflow.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,20 @@ jobs:
88
name: lint
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/setup-go@v4
11+
- uses: actions/setup-go@v5
1212
with:
13-
go-version: 1.23
14-
- uses: actions/checkout@v3
13+
go-version: 1.26
14+
- uses: actions/checkout@v4
1515
- name: golangci-lint
16-
uses: golangci/golangci-lint-action@v3
16+
uses: golangci/golangci-lint-action@v7
1717
with:
18-
version: v1.60.3
18+
version: v2.10.1
1919
args: --verbose
2020

2121
test:
2222
strategy:
2323
matrix:
24-
go-version: [1.23]
24+
go-version: [1.26]
2525
platform: [ubuntu-latest, macos-latest]
2626

2727
runs-on: ${{ matrix.platform }}

.golangci.yml

Lines changed: 64 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,79 @@
1-
linters-settings:
2-
errcheck:
3-
check-type-assertions: true
4-
goconst:
5-
min-len: 2
6-
min-occurrences: 3
7-
gocritic:
8-
enabled-tags:
9-
- diagnostic
10-
- experimental
11-
- opinionated
12-
- performance
13-
- style
14-
govet:
15-
shadow: true
16-
disable:
17-
- fieldalignment # too strict
1+
version: "2"
2+
3+
run:
4+
timeout: 5m
5+
issues-exit-code: 1
186

19-
nolintlint:
20-
require-explanation: false
21-
require-specific: true
227
linters:
23-
disable-all: true
248
enable:
25-
- bodyclose
26-
# - deadcode
27-
# depguard needs to be reviewed properly and then configured, before
28-
# it can be re-enabled.
29-
# https://github.com/OpenPeeDeeP/depguard#example-configs
30-
# - depguard
31-
- copyloopvar
32-
- dogsled
33-
# - dupl
9+
# correctness
3410
- errcheck
35-
- exhaustive
36-
- goconst
37-
- gocritic
38-
- gofmt
39-
- goimports
40-
- gocyclo
41-
- gosec
42-
- gosimple
4311
- govet
12+
- staticcheck
4413
- ineffassign
45-
- misspell
46-
- mnd
47-
- nolintlint
48-
- nakedret
14+
15+
# bug prevention
16+
- copyloopvar
17+
- bodyclose
18+
- exhaustive
19+
- unparam
20+
- unconvert
21+
22+
# code quality
23+
# - gocyclo # TODO: enable later, need to fix complexity issues
24+
- goconst
25+
- revive
4926
- prealloc
5027
- predeclared
51-
- revive
52-
- staticcheck
53-
# - structcheck
54-
- stylecheck
28+
29+
# security
30+
- gosec
31+
32+
# testing
5533
- thelper
5634
- tparallel
57-
- unconvert
58-
- unparam
59-
# - varcheck
35+
36+
# misc
37+
- misspell
6038
- whitespace
61-
- wsl
39+
- nolintlint
40+
- dogsled
41+
42+
settings:
43+
errcheck:
44+
check-type-assertions: true
45+
46+
goconst:
47+
min-len: 2
48+
min-occurrences: 3
49+
50+
gocyclo:
51+
min-complexity: 15
52+
53+
govet:
54+
enable:
55+
- shadow
6256

57+
revive:
58+
severity: warning
59+
60+
nolintlint:
61+
require-explanation: false
62+
require-specific: true
63+
64+
exclusions:
65+
rules:
66+
# Ginkgo/Gomega test suites use dot-imports by convention; suppress the
67+
# revive dot-imports warning for all test files.
68+
- path: '_test\.go'
69+
linters:
70+
- revive
71+
text: 'dot-imports'
72+
- path: '-auto\.go'
73+
linters:
74+
- errcheck
75+
text: 'Error return value is not checked'
6376
issues:
6477
max-issues-per-linter: 0
6578
max-same-issues: 0
66-
fix: true
67-
exclude:
68-
- "cuddle"
69-
70-
run:
71-
issues-exit-code: 1
72-
timeout: "5m"
79+
fix: false

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
## 🔰 Introduction
3333

34-
_[Cobra](https://cobra.dev/) is an excellent framework for the development of command line applications, but is missing a few features that would make it a bit easier to work with. This package aims to fulfil this purpose, especially in regards to creation of commands, encapsulating commands into a container and providing an export mechanism to re-create cli data in a form that is free from cobra (and indeed sundae) abstractions. The aim of this last aspect to to be able to inject data into the core of an application in a way that removes tight coupling to the `Cobra` framework, which is achieved by representing data only in terms of client defined (native) abstractions.
34+
[Cobra](https://cobra.dev/) is an excellent framework for the development of command line applications, but is missing a few features that would make it a bit easier to work with. This package aims to fulfil this purpose, especially in regards to creation of commands, encapsulating commands into a container and providing an export mechanism to re-create cli data in a form that is free from cobra (and indeed sundae) abstractions. The aim of this last aspect to to be able to inject data into the core of an application in a way that removes tight coupling to the `Cobra` framework, which is achieved by representing data only in terms of client defined (native) abstractions.
3535

3636
## 📚 Usage
3737

assist/assist-suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package assist_test
33
import (
44
"testing"
55

6-
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
7-
. "github.com/onsi/gomega" //nolint:revive // gomega ok
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
88
)
99

1010
func TestAssist(t *testing.T) {

assist/cfg/cfg-suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package cfg_test
33
import (
44
"testing"
55

6-
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
7-
. "github.com/onsi/gomega" //nolint:revive // gomega ok
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
88
)
99

1010
func TestCfg(t *testing.T) {

assist/cfg/global-config_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"path/filepath"
77
"time"
88

9-
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
10-
. "github.com/onsi/gomega" //nolint:revive // gomega ok
9+
. "github.com/onsi/ginkgo/v2"
10+
. "github.com/onsi/gomega"
1111
"github.com/spf13/viper"
1212
"go.uber.org/mock/gomock"
1313

assist/clif/clif-suite_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package clif_test
33
import (
44
"testing"
55

6-
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
7-
. "github.com/onsi/gomega" //nolint:revive // gomega ok
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
88
)
99

1010
func TestClif(t *testing.T) {

assist/clif/evaluate_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package clif_test
33
import (
44
"fmt"
55

6-
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
7-
. "github.com/onsi/gomega" //nolint:revive // gomega ok
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
88

99
"github.com/snivilised/sundae/assist/clif"
1010
)

assist/clif/expand_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ package clif_test
33
import (
44
"fmt"
55

6-
. "github.com/onsi/ginkgo/v2" //nolint:revive // ginkgo ok
7-
. "github.com/onsi/gomega" //nolint:revive // gomega ok
6+
. "github.com/onsi/ginkgo/v2"
7+
. "github.com/onsi/gomega"
88

99
"github.com/snivilised/sundae/assist/clif"
1010
)

assist/param-set-data_test.go

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package assist_test
22

33
import (
4-
"fmt"
54
"net"
65
"time"
76

@@ -65,42 +64,3 @@ type WidgetParameterSet struct {
6564
}
6665

6766
type InvalidParameterSet string
68-
69-
func duration(d string) time.Duration {
70-
result, _ := time.ParseDuration(d)
71-
return result
72-
}
73-
74-
func ipmask(v string) net.IPMask {
75-
var result net.IPMask
76-
77-
switch v {
78-
case "default":
79-
result = net.IPMask([]byte{0, 0, 0, 0})
80-
81-
case "orion.net":
82-
result = net.IPMask([]byte{255, 255, 255, 0})
83-
84-
default:
85-
panic(fmt.Errorf("no ipmask defined for: '%v'", v))
86-
}
87-
88-
return result
89-
}
90-
91-
func ipnet(v string) net.IPNet {
92-
var result net.IPNet
93-
94-
switch v {
95-
case "default":
96-
result = net.IPNet{IP: net.IPv4(0, 0, 0, 0), Mask: ipmask(v)}
97-
98-
case "orion.net":
99-
result = net.IPNet{IP: net.IPv4(172, 16, 0, 0), Mask: ipmask(v)}
100-
101-
default:
102-
panic(fmt.Errorf("no ipnet defined for: '%v'", v))
103-
}
104-
105-
return result
106-
}

0 commit comments

Comments
 (0)