mirror of
https://github.com/prometheus/node_exporter.git
synced 2024-12-27 14:39:53 -08:00
collector/diskstats: Don't use functions from Go 1.18
Since we need to support Go 1.17, don't use `strings.Cut()` which was introduced in Go 1.18. Signed-off-by: Benoît Knecht <bknecht@protonmail.ch>
This commit is contained in:
parent
a997b6096d
commit
75ceda8bb2
|
@ -361,9 +361,15 @@ func udevDeviceInformation(major, minor uint32) (udevInfo, error) {
|
|||
|
||||
scanner := bufio.NewScanner(data)
|
||||
for scanner.Scan() {
|
||||
/* TODO: After we drop support for Go 1.17, the condition below can be simplified to:
|
||||
|
||||
if name, value, found := strings.Cut(scanner.Text(), "="); found {
|
||||
info[name] = value
|
||||
}
|
||||
*/
|
||||
if fields := strings.SplitN(scanner.Text(), "=", 2); len(fields) == 2 {
|
||||
info[fields[0]] = fields[1]
|
||||
}
|
||||
}
|
||||
|
||||
return info, nil
|
||||
|
|
Loading…
Reference in a new issue