Skip to content

Commit 9951fd3

Browse files
committed
use defer && dont call colors again
1 parent d5fcc3e commit 9951fd3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ func display() {
2323
utils.GetDesktop(),
2424
utils.GetPackages(),
2525
}
26-
27-
ri := rand.Intn(len(colors()))
28-
re := colors()[ri]
26+
cols := colors()
27+
ri := rand.Intn(len(cols))
28+
re := cols[ri]
2929
maxLines := max(len(ascii), len(mods), len(cat))
3030

3131
for i := range maxLines {
@@ -51,7 +51,7 @@ func display() {
5151

5252
fmt.Printf("%-22s %-35s %s\n", re+asciiLine, modLine, catLine)
5353
}
54-
fmt.Printf("\033[0m")
54+
defer fmt.Printf("\033[0m")
5555
}
5656

5757
func colors() []string {

0 commit comments

Comments
 (0)