Skip to content

Commit ee2ebbd

Browse files
authored
[+] bump golangci/golangci-lint-action to v8 (#333)
1 parent c2183d9 commit ee2ebbd

File tree

7 files changed

+40
-23
lines changed

7 files changed

+40
-23
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
4040
- name: GolangCI-Lint
4141
if: runner.os == 'Linux'
42-
uses: golangci/golangci-lint-action@v6
42+
uses: golangci/golangci-lint-action@v8
4343
with:
4444
version: latest
4545
args: --verbose

.golangci.yml

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
version: "2"
12
linters:
23
enable:
34
- gocyclo
4-
- revive
55
- misspell
6-
- unused
7-
8-
linters-settings:
9-
gocyclo:
10-
# minimal code complexity to report, 30 by default (but we recommend 10-20)
11-
min-complexity: 16
6+
- revive
7+
settings:
8+
gocyclo:
9+
min-complexity: 16
10+
exclusions:
11+
generated: lax
12+
presets:
13+
- comments
14+
- common-false-positives
15+
- legacy
16+
- std-error-handling
17+
paths:
18+
- third_party$
19+
- builtin$
20+
- examples$
21+
formatters:
22+
exclusions:
23+
generated: lax
24+
paths:
25+
- third_party$
26+
- builtin$
27+
- examples$

checker/consul_leader_checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ func NewConsulLeaderChecker(con *vipconfig.Config) (lc *ConsulLeaderChecker, err
4242

4343
// GetChangeNotificationStream checks the status in the loop
4444
func (c *ConsulLeaderChecker) GetChangeNotificationStream(ctx context.Context, out chan<- bool) error {
45-
kv := c.Client.KV()
45+
kv := c.KV()
4646

4747
queryOptions := &api.QueryOptions{
4848
RequireConsistent: true,

checker/patroni_leader_checker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (c *PatroniLeaderChecker) GetChangeNotificationStream(ctx context.Context,
4747
case <-ctx.Done():
4848
return nil
4949
case <-time.After(time.Duration(c.Interval) * time.Millisecond):
50-
r, err := c.Client.Get(c.Endpoints[0] + c.TriggerKey)
50+
r, err := c.Get(c.Endpoints[0] + c.TriggerKey)
5151
if err != nil {
5252
c.Logger.Sugar().Error("patroni REST API error:", err)
5353
continue

ipmanager/basicConfigurer.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type BasicConfigurer struct {
2323
func newBasicConfigurer(config *IPConfiguration) (*BasicConfigurer, error) {
2424
c := &BasicConfigurer{IPConfiguration: config, ntecontext: 0}
2525
if c.Iface.HardwareAddr == nil || c.Iface.HardwareAddr.String() == "00:00:00:00:00:00" {
26-
return nil, errors.New(`Cannot run vip-manager on the loopback device
26+
return nil, errors.New(`cannot run vip-manager on the loopback device
2727
as its hardware address is the local address (00:00:00:00:00:00),
2828
which prohibits sending of gratuitous ARP messages`)
2929
}
@@ -70,9 +70,9 @@ func (c *BasicConfigurer) createGratuitousARP() ([]byte, error) {
7070
ProtAddressSize: IPv4AddressSize,
7171
Operation: layers.ARPReply, // Gratuitous ARP is sent as a reply
7272
SourceHwAddress: c.Iface.HardwareAddr,
73-
SourceProtAddress: c.IPConfiguration.VIP.AsSlice(),
73+
SourceProtAddress: c.VIP.AsSlice(),
7474
DstHwAddress: c.Iface.HardwareAddr, // Gratuitous ARP targets itself
75-
DstProtAddress: c.IPConfiguration.VIP.AsSlice(),
75+
DstProtAddress: c.VIP.AsSlice(),
7676
}
7777

7878
// Create a packet with the layers

ipmanager/hetznerConfigurer.go

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (c *HetznerConfigurer) curlQueryFailover(post bool) (string, error) {
8484
}
8585
if user == "" || password == "" {
8686
log.Infoln("Couldn't retrieve username or password from file", credentialsFile)
87-
return "", errors.New("Couldn't retrieve username or password from file")
87+
return "", errors.New("couldn't retrieve username or password from file")
8888
}
8989

9090
/**
@@ -101,33 +101,33 @@ func (c *HetznerConfigurer) curlQueryFailover(post bool) (string, error) {
101101
myOwnIP := getOutboundIP()
102102
if myOwnIP == nil {
103103
log.Error("Error determining this machine's IP address.")
104-
return "", errors.New("Error determining this machine's IP address")
104+
return "", errors.New("error determining this machine's IP address")
105105
}
106106
log.Infof("my_own_ip: %s\n", myOwnIP.String())
107107

108108
cmd = exec.Command("curl",
109109
"--ipv4",
110110
"-u", user+":"+password,
111-
"https://robot-ws.your-server.de/failover/"+c.IPConfiguration.VIP.String(),
111+
"https://robot-ws.your-server.de/failover/"+c.VIP.String(),
112112
"-d", "active_server_ip="+myOwnIP.String())
113113

114114
log.Debugf("%s %s %s '%s' %s %s %s",
115115
"curl",
116116
"--ipv4",
117117
"-u", user+":XXXXXX",
118-
"https://robot-ws.your-server.de/failover/"+c.IPConfiguration.VIP.String(),
118+
"https://robot-ws.your-server.de/failover/"+c.VIP.String(),
119119
"-d", "active_server_ip="+myOwnIP.String())
120120
} else {
121121
cmd = exec.Command("curl",
122122
"--ipv4",
123123
"-u", user+":"+password,
124-
"https://robot-ws.your-server.de/failover/"+c.IPConfiguration.VIP.String())
124+
"https://robot-ws.your-server.de/failover/"+c.VIP.String())
125125

126126
log.Debugf("%s %s %s %s %s",
127127
"curl",
128128
"--ipv4",
129129
"-u", user+":XXXXXX",
130-
"https://robot-ws.your-server.de/failover/"+c.IPConfiguration.VIP.String())
130+
"https://robot-ws.your-server.de/failover/"+c.VIP.String())
131131
}
132132

133133
out, err := cmd.Output()
@@ -164,7 +164,7 @@ func (c *HetznerConfigurer) getActiveIPFromJSON(str string) (net.IP, error) {
164164
errormap["status"].(float64),
165165
errormap["code"].(string),
166166
errormap["message"].(string))
167-
return nil, errors.New("Hetzner API returned error response")
167+
return nil, errors.New("error response from Hetzner API returned")
168168
}
169169

170170
if f["failover"] != nil {
@@ -202,9 +202,10 @@ func (c *HetznerConfigurer) queryAddress() bool {
202202
/** no need to check, we can use "cached" state if set.
203203
* if it is set to UNKNOWN, a check will be done.
204204
*/
205-
if c.cachedState == configured {
205+
switch c.cachedState {
206+
case configured:
206207
return true
207-
} else if c.cachedState == released {
208+
case released:
208209
return false
209210
}
210211
}

vipconfig/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ func NewConfig() (*Config, error) {
326326

327327
// if a configfile has been passed, make viper read it
328328
if err = loadConfigFile(); err != nil {
329-
return nil, fmt.Errorf("Fatal error reading config file: %w", err)
329+
return nil, fmt.Errorf("fatal error reading config file: %w", err)
330330
}
331331

332332
// convert string of csv to String Slice

0 commit comments

Comments
 (0)