Skip to content

Commit 1e6892d

Browse files
committed
Update formatting
1 parent 17250da commit 1e6892d

File tree

3 files changed

+32
-32
lines changed

3 files changed

+32
-32
lines changed

blockdevice/stats.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ type BlockQueueStats struct {
180180

181181
type IODeviceStats struct {
182182
IODoneCount uint64
183-
IOErrCount uint64
183+
IOErrCount uint64
184184
}
185185

186186
// DeviceMapperInfo models the devicemapper files that are located in the sysfs tree for each block device
@@ -486,20 +486,20 @@ func (fs FS) SysBlockDeviceUnderlyingDevices(device string) (UnderlyingDeviceInf
486486
// IO error count: /sys/block/<disk>/device/ioerr_cnt
487487
func (fs FS) SysBlockDeviceIOStat(device string) (IODeviceStats, error) {
488488
var (
489-
ioDeviceStats IODeviceStats
490-
err error
489+
ioDeviceStats IODeviceStats
490+
err error
491491
)
492492
for file, p := range map[string]*uint64{
493-
"iodone_cnt": &ioDeviceStats.IODoneCount,
494-
"ioerr_cnt": &ioDeviceStats.IOErrCount,
493+
"iodone_cnt": &ioDeviceStats.IODoneCount,
494+
"ioerr_cnt": &ioDeviceStats.IOErrCount,
495495
} {
496-
var val uint64
497-
val, err = util.ReadHexFromFile(fs.sys.Path(sysBlockPath, device, sysDevicePath, file))
498-
if err != nil {
499-
return IODeviceStats{}, err
500-
} else {
501-
*p = val
502-
}
496+
var val uint64
497+
val, err = util.ReadHexFromFile(fs.sys.Path(sysBlockPath, device, sysDevicePath, file))
498+
if err != nil {
499+
return IODeviceStats{}, err
500+
} else {
501+
*p = val
502+
}
503503
}
504504
return ioDeviceStats, nil
505505
}

ext4/ext4.go

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,26 @@ package ext4
1616

1717
import (
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

2626
const (
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.
3333
type 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.
7575
func (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)

internal/util/parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ func ParseBool(b string) *bool {
115115
func ReadHexFromFile(path string) (uint64, error) {
116116
data, err := os.ReadFile(path)
117117
if err != nil {
118-
return 0, err
118+
return 0, err
119119
}
120120
return strconv.ParseUint(strings.TrimSpace(string(data[2:])), 16, 64)
121121
}

0 commit comments

Comments
 (0)