Skip to content

Remove specs-go/parsing APIs #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions specs-go/parser.go

This file was deleted.

15 changes: 6 additions & 9 deletions specs-go/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,20 @@ func requiresV060(spec *Spec) bool {
}

// The v0.6.0 spec allows dots "." in Kind name label (class)
vendor, class := parseQualifier(spec.Kind)
if vendor != "" {
if strings.ContainsRune(class, '.') {
return true
}
if !strings.Contains(spec.Kind, "/") {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a subtle difference here in that if there is no / the class is assumed to equal the Kind. and that would be checked for a ..

I don't think that's used in practice though.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Wait, I've just seen the other conditional below.

return false
}

return false
class := strings.SplitN(spec.Kind, "/", 2)[1]
return strings.Contains(class, ".")
}

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

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