Dmitry Yu Okunev лет назад: 6
Родитель
Сommit
b8a98d89e1
1 измененных файлов с 6 добавлено и 5 удалено
  1. 6 5
      steps/main.go

+ 6 - 5
steps/main.go

@@ -1,14 +1,14 @@
 package main
 
 import (
+	"fmt"
 	"strconv"
 	"strings"
-	"fmt"
 )
 
 type step struct {
 	Destinations []string
-	Delay int
+	Delay        int
 }
 
 type steps []step
@@ -16,10 +16,11 @@ type steps []step
 func parseSteps(in string) (result steps) {
 	stepsStr := strings.Split(in, ",")
 	for _, stepStr := range stepsStr {
-		stepParts := strings.Split(stepStr, ":")
-		if len(stepParts) < 1 {
-			panic(fmt.Errorf("Invalid syntax: %v", stepStr))
+		if len(stepStr) == 0 {
+			fmt.Printf("An empty step, skipping.")
+			continue
 		}
+		stepParts := strings.Split(stepStr, ":")
 		delay := 0
 		if len(stepParts) >= 2 {
 			var err error