diff --git a/main.go b/main.go index cb1f0e0..cce1d60 100644 --- a/main.go +++ b/main.go @@ -48,6 +48,19 @@ func main() { evenNumber := 0 var remainder int + if upcLength < 10 { + gtins = append(gtins, "Cannot process upcs less than 10 digits") + continue + } + + if upcLength == 10 { + upc = "0" + upc + } + + if upcLength > 13 { + gtins = append(gtins, "GTINs longer than 14 digits are not valid") + } + for i, num := range upc { if i%2 == 0 { oddString, err := strconv.Atoi(string(num))