diff --git a/learn_go_with_tests/mocking/main b/learn_go_with_tests/mocking/main deleted file mode 100755 index 57fd4f8..0000000 Binary files a/learn_go_with_tests/mocking/main and /dev/null differ diff --git a/learn_go_with_tests/mocking/main.go b/learn_go_with_tests/mocking/main.go index e9903e0..434ec4e 100644 --- a/learn_go_with_tests/mocking/main.go +++ b/learn_go_with_tests/mocking/main.go @@ -1,6 +1,7 @@ package main import ( + "flag" "fmt" "io" "os" @@ -40,6 +41,10 @@ func Countdown(out io.Writer, sleeper Sleeper, count int) { } func main() { - sleeper := &ConfigurableSleeper{1 * time.Second, time.Sleep} - Countdown(os.Stdout, sleeper, 3) + count := flag.Int("count", 3, "Countdown start number") + seconds := flag.Float64("seconds", 1, "Number of sleep seconds between count calls") + flag.Parse() + + sleeper := &ConfigurableSleeper{time.Duration(*seconds * float64(time.Second)), time.Sleep} + Countdown(os.Stdout, sleeper, *count) }