Skip to content

Commit 48442a8

Browse files
author
Léonard DALLOT
committed
Fix static checks
1 parent e2ddeec commit 48442a8

File tree

2 files changed

+36
-40
lines changed

2 files changed

+36
-40
lines changed

internal/apis/checks_test.go

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,38 @@ func isNegative(v int) bool {
1010
return v < 0
1111
}
1212

13-
var testAnyOfWithIsNegative map[string]struct{
14-
input []int
13+
var testAnyOfWithIsNegative map[string]struct {
14+
input []int
1515
expected bool
16-
} = map[string]struct{
17-
input []int
16+
} = map[string]struct {
17+
input []int
1818
expected bool
19-
} {
20-
"isPresent":
21-
{
22-
input: []int{5, 7, -4, 6, 8},
23-
expected: true,
24-
},
25-
"isAbscent":
26-
{
27-
input: []int{5, 7, 4, 6, 8},
28-
expected: false,
29-
},
30-
"isEmpty":
31-
{
32-
input: []int{},
33-
expected: false,
34-
},
35-
"fisrt":{
36-
input:
37-
[]int{-5, 7, 4, 6, 8},
38-
expected: true,},
19+
}{
20+
"isPresent": {
21+
input: []int{5, 7, -4, 6, 8},
22+
expected: true,
23+
},
24+
"isAbscent": {
25+
input: []int{5, 7, 4, 6, 8},
26+
expected: false,
27+
},
28+
"isEmpty": {
29+
input: []int{},
30+
expected: false,
31+
},
32+
"fisrt": {
33+
input: []int{-5, 7, 4, 6, 8},
34+
expected: true,
35+
},
3936
"last": {
40-
input: []int{5, 7, 4, 6, -8},
37+
input: []int{5, 7, 4, 6, -8},
4138
expected: true,
4239
},
4340
}
4441

4542
func TestAnyOfIsNegative(t *testing.T) {
4643
for name, test := range testAnyOfWithIsNegative {
47-
t.Run(name, func (t *testing.T) {
44+
t.Run(name, func(t *testing.T) {
4845
t.Parallel()
4946
if got, expected := anyOf[int](test.input, isNegative), test.expected; got != expected {
5047
t.Errorf("anyOf[int](%q, isNegative) returned %t, expected %t", test.input, got, expected)
@@ -55,26 +52,26 @@ func TestAnyOfIsNegative(t *testing.T) {
5552

5653
func TestIsFD(t *testing.T) {
5754
var fd dbus.UnixFD
58-
var itfc interface{}
59-
tests := map[string]struct{
60-
input any
55+
var itfc interface{}
56+
tests := map[string]struct {
57+
input any
6158
expected bool
6259
}{
6360
"unixDF": {
64-
input: fd,
61+
input: fd,
6562
expected: true,
6663
},
6764
"int": {
68-
input: 5,
65+
input: 5,
6966
expected: false,
7067
},
7168
"interface": {
72-
input: itfc,
69+
input: itfc,
7370
expected: false,
7471
},
7572
}
7673
for name, test := range tests {
77-
t.Run(name, func (t *testing.T) {
74+
t.Run(name, func(t *testing.T) {
7875
t.Parallel()
7976
if got, expected := isFileDescriptor(test.input), test.expected; got != expected {
8077
t.Errorf("isFileDescriptor(%v) returned %t, expected %t", test.input, got, expected)
@@ -87,25 +84,25 @@ func TestAnyOfIsFDTrue(t *testing.T) {
8784
var fd dbus.UnixFD
8885
var i interface{}
8986

90-
tests := map[string] struct{
91-
input []any
87+
tests := map[string]struct {
88+
input []any
9289
expected bool
9390
}{
9491
"oneFd": {
95-
input: []any{5, fd, i},
92+
input: []any{5, fd, i},
9693
expected: true,
9794
},
9895
"noFd": {
99-
input: []any{5, -7, i},
96+
input: []any{5, -7, i},
10097
expected: false,
10198
},
10299
}
103100
for name, test := range tests {
104-
t.Run(name, func (t *testing.T) {
101+
t.Run(name, func(t *testing.T) {
105102
t.Parallel()
106103
if got, expected := anyOf[any](test.input, isFileDescriptor), test.expected; got != expected {
107104
t.Errorf("anyOf[any](%q, isFileDescriptor) returned %t, expected %t", test.input, got, expected)
108105
}
109106
})
110107
}
111-
}
108+
}

wallpaper/wallpaper.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,5 +64,4 @@ func readStatusFromResponse(path dbus.ObjectPath) error {
6464
default:
6565
return errors.New("unknown status code")
6666
}
67-
return nil
6867
}

0 commit comments

Comments
 (0)