Skip to content

Commit fd4d0fa

Browse files
committed
Lint
Signed-off-by: Örnfeldt Philip (66140321) <[email protected]>
1 parent 5fadbc6 commit fd4d0fa

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

pkg/http/forti_token_client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (c *fortiTokenClient) Get(path string, query string, obj interface{}) error
7777
return err
7878
}
7979
if resp.StatusCode != 200 {
80-
return fmt.Errorf("Response code was %d, expected 200 (path: %q)", resp.StatusCode, path)
80+
return fmt.Errorf("response code was %d, expected 200 (path: %q)", resp.StatusCode, path)
8181
}
8282

8383
b, err := io.ReadAll(resp.Body)

pkg/probe/firewall_load_balance.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,12 @@ func probeFirewallLoadBalance(c http.FortiHTTP, meta *TargetMetadata) ([]prometh
133133
}
134134

135135
realServerRTTValue := math.NaN()
136-
if "<1" == realServer.RTT {
136+
switch realServer.RTT {
137+
case "<1":
137138
realServerRTTValue = 0.001
138-
} else if "" == realServer.RTT {
139+
case "":
139140
// NaN
140-
} else {
141+
default:
141142
if realServerRTTValueInMs, err := strconv.ParseFloat(realServer.RTT, 64); err != nil {
142143
log.Printf("Failed to parse RTT value: %v", err)
143144
} else {

pkg/probe/probe.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (p *ProbeCollector) Probe(ctx context.Context, target map[string]string, hc
6767
}
6868

6969
if tgt.Scheme != "https" && tgt.Scheme != "http" {
70-
return false, fmt.Errorf("Unsupported scheme %q", tgt.Scheme)
70+
return false, fmt.Errorf("unsupported scheme %q", tgt.Scheme)
7171
}
7272

7373
// Filter anything else than scheme and hostname

pkg/probe/system_sdn_connector.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,16 @@ func probeSystemSDNConnector(c http.FortiHTTP, meta *TargetMetadata) ([]promethe
5656
m := []prometheus.Metric{}
5757
for _, r := range res {
5858
for _, sdnConn := range r.Results {
59-
if sdnConn.Status == "Disabled" {
59+
switch sdnConn.Status {
60+
case "Disabled":
6061
m = append(m, prometheus.MustNewConstMetric(SDNConnectorsStatus, prometheus.GaugeValue, float64(0), r.VDOM, sdnConn.Name, sdnConn.Type))
61-
} else if sdnConn.Status == "Down" {
62+
case "Down":
6263
m = append(m, prometheus.MustNewConstMetric(SDNConnectorsStatus, prometheus.GaugeValue, float64(1), r.VDOM, sdnConn.Name, sdnConn.Type))
63-
} else if sdnConn.Status == "Unknown" {
64+
case "Unknown":
6465
m = append(m, prometheus.MustNewConstMetric(SDNConnectorsStatus, prometheus.GaugeValue, float64(2), r.VDOM, sdnConn.Name, sdnConn.Type))
65-
} else if sdnConn.Status == "Up" {
66+
case "Up":
6667
m = append(m, prometheus.MustNewConstMetric(SDNConnectorsStatus, prometheus.GaugeValue, float64(3), r.VDOM, sdnConn.Name, sdnConn.Type))
67-
} else if sdnConn.Status == "Updating" {
68+
case "Updating":
6869
m = append(m, prometheus.MustNewConstMetric(SDNConnectorsStatus, prometheus.GaugeValue, float64(4), r.VDOM, sdnConn.Name, sdnConn.Type))
6970
}
7071
m = append(m, prometheus.MustNewConstMetric(SDNConnectorsLastUpdate, prometheus.GaugeValue, float64(sdnConn.LastUpdate), r.VDOM, sdnConn.Name, sdnConn.Type))

0 commit comments

Comments
 (0)