File tree 2 files changed +19
-15
lines changed
2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -222,23 +222,26 @@ func Parse(inVersioin string) (*Version, error) {
222
222
223
223
// Builds parsing
224
224
buildIdx := currIdx + 1
225
- for {
226
- if hasNext := next (); ! hasNext || curr == '.' {
227
- if buildIdx == currIdx {
228
- return nil , fmt .Errorf ("empty build tag not allowed" )
225
+ if curr == '+' {
226
+ for {
227
+ if hasNext := next (); ! hasNext || curr == '.' {
228
+ if buildIdx == currIdx {
229
+ return nil , fmt .Errorf ("empty build tag not allowed" )
230
+ }
231
+ result .builds = append (result .builds , in [buildIdx :currIdx ])
232
+ if ! hasNext {
233
+ return result , nil
234
+ }
235
+
236
+ // Multiple builds
237
+ buildIdx = currIdx + 1
238
+ continue
229
239
}
230
- result .builds = append (result .builds , in [buildIdx :currIdx ])
231
- if ! hasNext {
232
- return result , nil
240
+ if identifier [curr ] {
241
+ continue
233
242
}
234
-
235
- // Multiple builds
236
- buildIdx = currIdx + 1
237
- continue
238
- }
239
- if identifier [curr ] {
240
- continue
243
+ return nil , fmt .Errorf ("invalid separator for builds: '%c'" , curr )
241
244
}
242
- return nil , fmt .Errorf ("invalid separator for builds: '%c'" , curr )
243
245
}
246
+ return nil , fmt .Errorf ("invalid separator: '%c'" , curr )
244
247
}
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ func TestParser(t *testing.T) {
44
44
}
45
45
46
46
valid ("" , "0.0.0" , ",," )
47
+ invalid ("0.0.0.0" )
47
48
invalid ("a" )
48
49
invalid ("." )
49
50
invalid ("-ab" )
You can’t perform that action at this time.
0 commit comments