@@ -16,26 +16,26 @@ package ext4
1616
1717import (
1818 "fmt"
19- "strings"
2019 "path/filepath"
20+ "strings"
2121
2222 "github.com/prometheus/procfs/internal/fs"
2323 "github.com/prometheus/procfs/internal/util"
2424)
2525
2626const (
27- sysFSPath = "fs"
28- sysFSExt4Path = "ext4"
27+ sysFSPath = "fs"
28+ sysFSExt4Path = "ext4"
2929)
3030
3131// Stats contains statistics for a single Btrfs filesystem.
3232// See Linux fs/btrfs/sysfs.c for more information.
3333type Stats struct {
34- Name string
34+ Name string
3535
36- Errors uint64
37- Warnings uint64
38- Messages uint64
36+ Errors uint64
37+ Warnings uint64
38+ Messages uint64
3939}
4040
4141// FS represents the pseudo-filesystems proc and sys, which provides an
@@ -74,8 +74,8 @@ func NewFS(procMountPoint string, sysMountPoint string) (FS, error) {
7474// ProcStat returns stats for the filesystem.
7575func (fs FS ) ProcStat () ([]* Stats , error ) {
7676 matches , err := filepath .Glob (fs .sys .Path ("fs/ext4/*" ))
77- if ( err != nil ) {
78- return nil , err
77+ if err != nil {
78+ return nil , err
7979 }
8080
8181 stats := make ([]* Stats , 0 , len (matches ))
@@ -86,17 +86,17 @@ func (fs FS) ProcStat() ([]*Stats, error) {
8686 name := filepath .Base (m )
8787 s .Name = name
8888 for file , p := range map [string ]* uint64 {
89- "errors_count" : & s .Errors ,
90- "warning_count" : & s .Warnings ,
91- "msg_count" : & s .Messages ,
89+ "errors_count" : & s .Errors ,
90+ "warning_count" : & s .Warnings ,
91+ "msg_count" : & s .Messages ,
9292 } {
93- var val uint64
94- val , err = util .ReadUintFromFile (fs .sys .Path (sysFSPath , sysFSExt4Path , name , file ))
95- if err != nil {
96- fmt .Errorf ("failed to read ext4 stats from %s: %w" , file , err )
97- } else {
98- * p = val
99- }
93+ var val uint64
94+ val , err = util .ReadUintFromFile (fs .sys .Path (sysFSPath , sysFSExt4Path , name , file ))
95+ if err != nil {
96+ fmt .Errorf ("failed to read ext4 stats from %s: %w" , file , err )
97+ } else {
98+ * p = val
99+ }
100100 }
101101
102102 stats = append (stats , s )
0 commit comments