Skip to content

Inconsistent naming of the specs-go module #227

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

Closed
Tracked by #206
bart0sh opened this issue Aug 27, 2024 · 4 comments
Closed
Tracked by #206

Inconsistent naming of the specs-go module #227

bart0sh opened this issue Aug 27, 2024 · 4 comments
Assignees

Comments

@bart0sh
Copy link
Contributor

bart0sh commented Aug 27, 2024

$ git grep 'container-device-interface/specs-go"'
pkg/cdi/cache.go:       cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/cache_test.go:  cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/container-edits.go:     "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/container-edits_test.go:        cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/device.go:      cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/device_test.go: cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/doc.go://       "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/doc.go://       "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/registry.go:    cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/spec.go:        cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/spec_test.go:   cdi "tags.cncf.io/container-device-interface/specs-go"
pkg/cdi/validate/schema.go:     raw "tags.cncf.io/container-device-interface/specs-go"

I'd propose to replace all of that with unnamed import "tags.cncf.io/container-device-interface/specs-go"

@klihub
Copy link
Contributor

klihub commented Aug 28, 2024

Isn't that consistent naming ? I mean everywhere within pkg/cdi, we call cdi specs-go cdi, so the spec reference reads cdi.Spec, not specs.Spec. Similarly we call opencontainers/runtime-spec/spec-go oci, so we have then oci.Spec in the code.

Anyway we need to import one of them with a renamed alias, since we can't call both of them specs in the same file within a module. So then probably you would have specs.Spec instead of cdi.Spec and maybe oci.Spec or ocispec.Spec for the oci Spec. Personally I'd consider both of these less readable than the current implementation choice.

@klihub
Copy link
Contributor

klihub commented Aug 28, 2024

Ah ok. In pkg/container-edits.go we're inconsistent. If the current and above described reasoning is acceptable, then at least that should be changed to be consistent with the rest within pkg/cdi. And then I'd change raw to cdi in pkg/cdi/validate/schema.go as well.

@klihub
Copy link
Contributor

klihub commented Aug 28, 2024

Ah ok. In pkg/container-edits.go we're inconsistent... And then I'd change raw to cdi in pkg/cdi/validate/schema.go as well.

Filed #228 to fix those.

@bart0sh
Copy link
Contributor Author

bart0sh commented Sep 2, 2024

This seems to be closed by #228
/close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants