Skip to content

Commit d5e1755

Browse files
committed
fix(filesystem): add comma separator in mountOptionsString
mountOptionsString was concatenating options without commas, breaking readonly dete Signed-off-by: Ray Tien <[email protected]>
1 parent b644734 commit d5e1755

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

collector/filesystem_linux.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
package collector
1717

1818
import (
19-
"bytes"
2019
"errors"
2120
"fmt"
2221
"log/slog"
@@ -237,13 +236,13 @@ func isFilesystemReadOnly(labels filesystemLabels) bool {
237236
}
238237

239238
func mountOptionsString(m map[string]string) string {
240-
b := new(bytes.Buffer)
239+
var parts []string
241240
for key, value := range m {
242241
if value == "" {
243-
fmt.Fprintf(b, "%s", key)
242+
parts = append(parts, key)
244243
} else {
245-
fmt.Fprintf(b, "%s=%s", key, value)
244+
parts = append(parts, key+"="+value)
246245
}
247246
}
248-
return b.String()
247+
return strings.Join(parts, ",")
249248
}

0 commit comments

Comments
 (0)