Skip to content

Commit c0da164

Browse files
authored
Merge pull request #228 from klihub/fixes/consistent-imports
pkg/cdi: name cdi specs-go imports consistently.
2 parents 96643f9 + 57b0d1b commit c0da164

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

pkg/cdi/container-edits.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626

2727
oci "github.com/opencontainers/runtime-spec/specs-go"
2828
ocigen "github.com/opencontainers/runtime-tools/generate"
29-
"tags.cncf.io/container-device-interface/specs-go"
29+
cdi "tags.cncf.io/container-device-interface/specs-go"
3030
)
3131

3232
const (
@@ -64,7 +64,7 @@ var (
6464
// to all OCI Specs where at least one devices from the CDI Spec
6565
// is injected.
6666
type ContainerEdits struct {
67-
*specs.ContainerEdits
67+
*cdi.ContainerEdits
6868
}
6969

7070
// Apply edits to the given OCI Spec. Updates the OCI Spec in place.
@@ -205,7 +205,7 @@ func (e *ContainerEdits) Append(o *ContainerEdits) *ContainerEdits {
205205
e = &ContainerEdits{}
206206
}
207207
if e.ContainerEdits == nil {
208-
e.ContainerEdits = &specs.ContainerEdits{}
208+
e.ContainerEdits = &cdi.ContainerEdits{}
209209
}
210210

211211
e.Env = append(e.Env, o.Env...)
@@ -259,7 +259,7 @@ func ValidateEnv(env []string) error {
259259

260260
// DeviceNode is a CDI Spec DeviceNode wrapper, used for validating DeviceNodes.
261261
type DeviceNode struct {
262-
*specs.DeviceNode
262+
*cdi.DeviceNode
263263
}
264264

265265
// Validate a CDI Spec DeviceNode.
@@ -289,7 +289,7 @@ func (d *DeviceNode) Validate() error {
289289

290290
// Hook is a CDI Spec Hook wrapper, used for validating hooks.
291291
type Hook struct {
292-
*specs.Hook
292+
*cdi.Hook
293293
}
294294

295295
// Validate a hook.
@@ -308,7 +308,7 @@ func (h *Hook) Validate() error {
308308

309309
// Mount is a CDI Mount wrapper, used for validating mounts.
310310
type Mount struct {
311-
*specs.Mount
311+
*cdi.Mount
312312
}
313313

314314
// Validate a mount.
@@ -325,13 +325,13 @@ func (m *Mount) Validate() error {
325325
// IntelRdt is a CDI IntelRdt wrapper.
326326
// This is used for validation and conversion to OCI specifications.
327327
type IntelRdt struct {
328-
*specs.IntelRdt
328+
*cdi.IntelRdt
329329
}
330330

331331
// ValidateIntelRdt validates the IntelRdt configuration.
332332
//
333333
// Deprecated: ValidateIntelRdt is deprecated use IntelRdt.Validate() instead.
334-
func ValidateIntelRdt(i *specs.IntelRdt) error {
334+
func ValidateIntelRdt(i *cdi.IntelRdt) error {
335335
return (&IntelRdt{i}).Validate()
336336
}
337337

pkg/cdi/validate/schema.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package validate
1818

1919
import (
2020
"tags.cncf.io/container-device-interface/schema"
21-
raw "tags.cncf.io/container-device-interface/specs-go"
21+
cdi "tags.cncf.io/container-device-interface/specs-go"
2222
)
2323

2424
const (
@@ -27,29 +27,29 @@ const (
2727
)
2828

2929
// WithSchema returns a CDI Spec validator that uses the given Schema.
30-
func WithSchema(s *schema.Schema) func(*raw.Spec) error {
30+
func WithSchema(s *schema.Schema) func(*cdi.Spec) error {
3131
if s == nil {
32-
return func(*raw.Spec) error {
32+
return func(*cdi.Spec) error {
3333
return nil
3434
}
3535
}
36-
return func(spec *raw.Spec) error {
36+
return func(spec *cdi.Spec) error {
3737
return s.ValidateType(spec)
3838
}
3939
}
4040

4141
// WithNamedSchema loads the named JSON schema and returns a CDI Spec
4242
// validator for it. If loading the schema fails a dummy validator is
4343
// returned.
44-
func WithNamedSchema(name string) func(*raw.Spec) error {
44+
func WithNamedSchema(name string) func(*cdi.Spec) error {
4545
s, _ := schema.Load(name)
4646
return WithSchema(s)
4747
}
4848

4949
// WithDefaultSchema returns a CDI Spec validator that uses the default
5050
// external JSON schema, or the default builtin one if the external one
5151
// fails to load.
52-
func WithDefaultSchema() func(*raw.Spec) error {
52+
func WithDefaultSchema() func(*cdi.Spec) error {
5353
s, err := schema.Load(DefaultExternalSchema)
5454
if err == nil {
5555
return WithSchema(s)

0 commit comments

Comments
 (0)