Skip to content

Commit 1057f0e

Browse files
authored
Merge pull request #221 from bart0sh/PR022-specs-go-remove-parsing-functions
Remove specs-go/parsing APIs
2 parents 39d5eb5 + 8de8603 commit 1057f0e

File tree

2 files changed

+6
-48
lines changed

2 files changed

+6
-48
lines changed

specs-go/parser.go

Lines changed: 0 additions & 39 deletions
This file was deleted.

specs-go/version.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -183,23 +183,20 @@ func requiresV060(spec *Spec) bool {
183183
}
184184

185185
// The v0.6.0 spec allows dots "." in Kind name label (class)
186-
vendor, class := parseQualifier(spec.Kind)
187-
if vendor != "" {
188-
if strings.ContainsRune(class, '.') {
189-
return true
190-
}
186+
if !strings.Contains(spec.Kind, "/") {
187+
return false
191188
}
192-
193-
return false
189+
class := strings.SplitN(spec.Kind, "/", 2)[1]
190+
return strings.Contains(class, ".")
194191
}
195192

196193
// requiresV050 returns true if the spec uses v0.5.0 features
197194
func requiresV050(spec *Spec) bool {
198195
var edits []*ContainerEdits
199196

200197
for _, d := range spec.Devices {
201-
// The v0.5.0 spec allowed device names to start with a digit instead of requiring a letter
202-
if len(d.Name) > 0 && !isLetter(rune(d.Name[0])) {
198+
// The v0.5.0 spec allowed device name to start with a digit
199+
if len(d.Name) > 0 && '0' <= d.Name[0] && d.Name[0] <= '9' {
203200
return true
204201
}
205202
edits = append(edits, &d.ContainerEdits)

0 commit comments

Comments
 (0)