From f515ec27f8f91c8a9a8073a57834f6eaaf8add4a Mon Sep 17 00:00:00 2001 From: xpetit <32063953+xpetit@users.noreply.github.com> Date: Thu, 17 Jun 2021 16:44:59 +0200 Subject: [PATCH] Simplify --- sh/debian/ubuntu/system/usr/local/src/format/main.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sh/debian/ubuntu/system/usr/local/src/format/main.go b/sh/debian/ubuntu/system/usr/local/src/format/main.go index 3e195e64..90ccae29 100644 --- a/sh/debian/ubuntu/system/usr/local/src/format/main.go +++ b/sh/debian/ubuntu/system/usr/local/src/format/main.go @@ -170,13 +170,10 @@ func main() { return } var nb int - if len(devices) > 1 { + if choice != "" { nb, err := strconv.Atoi(choice) - if err != nil { - fatalln("Wrong disk number", choice) - } - if nb < 0 || nb >= len(devices) { - fatalln("Wrong disk number, choose between", 0, "and", len(devices)-1) + if err != nil || nb < 0 || nb >= len(devices) { + fatalln("Wrong disk number:", choice) } } device := devices[nb]