summaryrefslogtreecommitdiff
path: root/philo.go
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2017-02-25 23:35:03 +0100
committerDimitri Sokolyuk <demon@dim13.org>2017-02-25 23:35:03 +0100
commit3ef9e0c337ed2eec1be47766aa4253e973a0d839 (patch)
tree37958489c6d53b20bd51e8f2fc2052ce44d46102 /philo.go
parent58009b2eda80604fae86605f0b25e330bc9b190d (diff)
Set limit at minimal names count
Diffstat (limited to 'philo.go')
-rw-r--r--philo.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/philo.go b/philo.go
index 811c698..030195c 100644
--- a/philo.go
+++ b/philo.go
@@ -1,6 +1,7 @@
package main
import (
+ "errors"
"flag"
"fmt"
"math/rand"
@@ -106,6 +107,9 @@ func (n Names) String() string {
func (n *Names) Set(s string) error {
*n = Names(strings.Split(s, ","))
+ if len(*n) < 2 {
+ return errors.New("at least 2 names are required")
+ }
return nil
}