Browse Source

Add blank case for convertUnit

Assumes that it's in bytes. On my system (Arch Linux), values of 0 have
no unit printed next to them.
Ian Adam Naval 5 years ago
parent
commit
d621f8d765
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      free/main.go

+ 3
- 1
free/main.go View File

@@ -23,8 +23,10 @@ func convertUnit(stringUnit string) (jsh.Unit, error) {
23 23
 		return jsh.GB, nil
24 24
 	case "tB":
25 25
 		return jsh.TB, nil
26
+	case "":
27
+		return jsh.B, nil
26 28
 	default:
27
-		return 0, errors.New(fmt.Sprintln("Unknown unit %s", stringUnit))
29
+		return 0, errors.New(fmt.Sprintf("Unknown unit: %s\n", stringUnit))
28 30
 	}
29 31
 }
30 32
 

Loading…
Cancel
Save