Skip to content

Commit ca29441

Browse files
committed
Fixup golangci-lint errors.
Signed-off-by: SuperQ <[email protected]>
1 parent 244a305 commit ca29441

6 files changed

+12
-20
lines changed

.golangci.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
linters:
3+
enable:
4+
- misspell
5+
- sloglint
6+
7+
issues:
8+
exclude-rules:
9+
- path: _test.go
10+
linters:
11+
- errcheck

pkg/probe/firewall_load_balance.go

-5
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,18 @@ func probeFirewallLoadBalance(c http.FortiHTTP, meta *TargetMetadata) ([]prometh
116116
switch realServer.Mode {
117117
case "active":
118118
realServerModeActive = 1.0
119-
break
120119
case "standby":
121120
realServerModeStandby = 1.0
122-
break
123121
case "disabled":
124122
realServerModeDisabled = 1.0
125-
break
126123
}
127124

128125
realServerStatusUp, realServerStatusDown, realServerStatusUnknown := 0.0, 0.0, 0.0
129126
switch realServer.Status {
130127
case "up":
131128
realServerStatusUp = 1.0
132-
break
133129
case "down":
134130
realServerStatusDown = 1.0
135-
break
136131
default:
137132
realServerStatusUnknown = 1.0
138133
}

pkg/probe/probe.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func (p *ProbeCollector) Probe(ctx context.Context, target map[string]string, hc
7878

7979
if target["token"] != "" && savedConfig.AuthKeys[config.Target(target["target"])].Token == "" {
8080
// Add the target and its apikey to the savedConfig and use, if exists, a target entry as a template for include/exclude
81-
// This will only happend the "first" time
81+
// This will only happened the "first" time
8282
savedConfig.AuthKeys[config.Target(target["target"])] = config.TargetAuth{Token: config.Token(target["token"]),
8383
Probes: savedConfig.AuthKeys[config.Target(target["profile"])].Probes}
8484
}

pkg/probe/system_fortimanager.go

-7
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,28 @@ func probeSystemFortimanagerStatus(c http.FortiHTTP, meta *TargetMetadata) ([]pr
5858
case 0:
5959
// No management Tunnel
6060
StatusDown = 1.0
61-
break
6261
case 1:
6362
// Management tunnel establishment in progress
6463
StatusHandshake = 1.0
65-
break
6664
case 2:
6765
// Management tunnel is establised
6866
StatusUp = 1.0
69-
break
7067
}
7168

7269
RegistrationUnknown, RegistrationInProgress, RegistrationRegistered, RegistrationUnregistered := 0.0, 0.0, 0.0, 0.0
7370
switch r.Results.Registration_ID {
7471
case 0:
7572
// FMG does not know about the device
7673
RegistrationUnknown = 1.0
77-
break
7874
case 1:
7975
// FMG does know the device, but it is not yet fully saved in the list of unregistered devices
8076
RegistrationInProgress = 1.0
81-
break
8277
case 2:
8378
// FMG does know the device, and device is authorized
8479
RegistrationRegistered = 1.0
85-
break
8680
case 3:
8781
// FMG does know the device, but it is not yet authorized
8882
RegistrationUnregistered = 1.0
89-
break
9083
}
9184

9285
m = append(m, prometheus.MustNewConstMetric(FortimanStat_id, prometheus.GaugeValue, StatusDown, r.VDOM, r.Results.Mode, "down"))

pkg/probe/system_link_monitor.go

-3
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,10 @@ func probeSystemLinkMonitor(c http.FortiHTTP, meta *TargetMetadata) ([]prometheu
117117
switch link.Status {
118118
case "up":
119119
wanStatusUp = 1.0
120-
break
121120
case "down":
122121
wanStatusDown = 1.0
123-
break
124122
case "error":
125123
wanStatusError = 1.0
126-
break
127124
default:
128125
wanStatusUnknown = 1.0
129126
}

pkg/probe/virtual_wan_health_check.go

-4
Original file line numberDiff line numberDiff line change
@@ -117,16 +117,12 @@ func probeVirtualWANHealthCheck(c http.FortiHTTP, meta *TargetMetadata) ([]prome
117117
switch Member.Status {
118118
case "up":
119119
MemberStatusUp = 1.0
120-
break
121120
case "down":
122121
MemberStatusDown = 1.0
123-
break
124122
case "error":
125123
MemberStatusError = 1.0
126-
break
127124
case "disable":
128125
MemberStatusDisable = 1.0
129-
break
130126
default:
131127
MemberStatusUnknown = 1.0
132128
}

0 commit comments

Comments
 (0)