summaryrefslogtreecommitdiff
path: root/vendor/github.com/prometheus/procfs/net_protocols.go
diff options
context:
space:
mode:
authorLibravatar kim <grufwub@gmail.com>2025-05-26 16:13:55 +0200
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-05-26 16:13:55 +0200
commit143febb318ee16ca68ea312249ab5dadeab608bb (patch)
tree594820ce5f746c7c9d0e28cc8820da563b0c4bdd /vendor/github.com/prometheus/procfs/net_protocols.go
parent[chore] migration to update `statuses.thread_id` to be notnull (#4160) (diff)
downloadgotosocial-143febb318ee16ca68ea312249ab5dadeab608bb.tar.xz
[chore] update dependencies (#4196)
- go.opentelemetry.io/contrib/exporters/autoexport v0.60.0 -> v0.61.0 - go.opentelemetry.io/contrib/instrumentation/runtime v0.60.0 -> v0.61.0 Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4196 Co-authored-by: kim <grufwub@gmail.com> Co-committed-by: kim <grufwub@gmail.com>
Diffstat (limited to 'vendor/github.com/prometheus/procfs/net_protocols.go')
-rw-r--r--vendor/github.com/prometheus/procfs/net_protocols.go21
1 files changed, 12 insertions, 9 deletions
diff --git a/vendor/github.com/prometheus/procfs/net_protocols.go b/vendor/github.com/prometheus/procfs/net_protocols.go
index b6c77b709..8d4b1ac05 100644
--- a/vendor/github.com/prometheus/procfs/net_protocols.go
+++ b/vendor/github.com/prometheus/procfs/net_protocols.go
@@ -115,22 +115,24 @@ func (ps NetProtocolStats) parseLine(rawLine string) (*NetProtocolStatLine, erro
if err != nil {
return nil, err
}
- if fields[4] == enabled {
+ switch fields[4] {
+ case enabled:
line.Pressure = 1
- } else if fields[4] == disabled {
+ case disabled:
line.Pressure = 0
- } else {
+ default:
line.Pressure = -1
}
line.MaxHeader, err = strconv.ParseUint(fields[5], 10, 64)
if err != nil {
return nil, err
}
- if fields[6] == enabled {
+ switch fields[6] {
+ case enabled:
line.Slab = true
- } else if fields[6] == disabled {
+ case disabled:
line.Slab = false
- } else {
+ default:
return nil, fmt.Errorf("%w: capability for protocol: %s", ErrFileParse, line.Name)
}
line.ModuleName = fields[7]
@@ -168,11 +170,12 @@ func (pc *NetProtocolCapabilities) parseCapabilities(capabilities []string) erro
}
for i := 0; i < len(capabilities); i++ {
- if capabilities[i] == "y" {
+ switch capabilities[i] {
+ case "y":
*capabilityFields[i] = true
- } else if capabilities[i] == "n" {
+ case "n":
*capabilityFields[i] = false
- } else {
+ default:
return fmt.Errorf("%w: capability block for protocol: position %d", ErrFileParse, i)
}
}