Skip to content

Commit ebbcb9d

Browse files
committed
Small correctness and formatting fixes.
* Use `defer` for WaitGroup in case of panic. * Fix wording in comment. Signed-off-by: Walter Mays <[email protected]>
1 parent 8d4c6fd commit ebbcb9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

collector/filesystem_linux.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
6565
for i := 0; i < workerCount; i++ {
6666
wg.Add(1)
6767
go func() {
68+
defer wg.Done()
6869
for labels := range labelChan {
6970
statChan <- c.processStat(labels)
7071
}
71-
wg.Done()
7272
}()
7373
}
7474

@@ -107,7 +107,7 @@ func (c *filesystemCollector) GetStats() ([]filesystemStats, error) {
107107
}
108108

109109
func (c *filesystemCollector) processStat(labels filesystemLabels) filesystemStats {
110-
// The success channel is used do tell the "watcher" that the stat
110+
// The success channel is used to tell the "watcher" that the stat
111111
// finished successfully. The channel is closed on success.
112112
success := make(chan struct{})
113113
go stuckMountWatcher(labels.mountPoint, success, c.logger)

0 commit comments

Comments
 (0)