Skip to content

Commit

Permalink
fix: fmt
Browse files Browse the repository at this point in the history
dundee committed Nov 30, 2024
1 parent 1605904 commit f69bda9
Showing 3 changed files with 15 additions and 15 deletions.
14 changes: 6 additions & 8 deletions pkg/analyze/top.go
Original file line number Diff line number Diff line change
@@ -25,14 +25,12 @@ func (tl *TopList) Add(file fs.Item) {
if file.GetSize() > tl.MinSize {
tl.MinSize = file.GetSize()
}
} else {
if file.GetSize() > tl.MinSize {
tl.Items = append(tl.Items, file)
tl.MinSize = file.GetSize()
if len(tl.Items) > tl.Count {
sort.Sort(fs.ByApparentSize(tl.Items))
tl.Items = tl.Items[1:]
}
} else if file.GetSize() > tl.MinSize {
tl.Items = append(tl.Items, file)
tl.MinSize = file.GetSize()
if len(tl.Items) > tl.Count {
sort.Sort(fs.ByApparentSize(tl.Items))
tl.Items = tl.Items[1:]
}
}
}
14 changes: 8 additions & 6 deletions stdout/stdout.go
Original file line number Diff line number Diff line change
@@ -170,11 +170,12 @@ func (ui *UI) AnalyzePath(path string, _ fs.Item) error {

wait.Wait()

if ui.top > 0 {
switch {
case ui.top > 0:
ui.printTopFiles(dir)
} else if ui.summarize {
case ui.summarize:
ui.printTotalItem(dir)
} else {
default:
ui.showDir(dir)
}

@@ -192,11 +193,12 @@ func (ui *UI) ReadFromStorage(storagePath, path string) error {
return err
}

if ui.top > 0 {
switch {
case ui.top > 0:
ui.printTopFiles(dir)
} else if ui.summarize {
case ui.summarize:

Check warning on line 199 in stdout/stdout.go

Codecov / codecov/patch

stdout/stdout.go#L196-L199

Added lines #L196 - L199 were not covered by tests
ui.printTotalItem(dir)
} else {
default:

Check warning on line 201 in stdout/stdout.go

Codecov / codecov/patch

stdout/stdout.go#L201

Added line #L201 was not covered by tests
ui.showDir(dir)
}
return nil
2 changes: 1 addition & 1 deletion stdout/stdout_linux_test.go
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ func TestShowDevicesWithErr(t *testing.T) {
output := bytes.NewBuffer(make([]byte, 10))

getter := device.LinuxDevicesInfoGetter{MountsPath: "/xyzxyz"}
ui := CreateStdoutUI(output, false, true, false, false, false, false, false, false)
ui := CreateStdoutUI(output, false, true, false, false, false, false, false, false, 0)
err := ui.ListDevices(getter)

assert.Contains(t, err.Error(), "no such file")

0 comments on commit f69bda9

Please sign in to comment.