Add hook command to nvidia-ctk with update-ldcache subcommand

Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
Evan Lezar
2022-03-14 13:53:22 +02:00
parent c945cc714d
commit 1c892af215
5 changed files with 213 additions and 5 deletions

View File

@@ -52,7 +52,7 @@ func (s *fileSpec) Load() error {
}
defer specFile.Close()
spec, err := loadFrom(specFile)
spec, err := LoadFrom(specFile)
if err != nil {
return fmt.Errorf("error loading OCI specification from file: %v", err)
}
@@ -60,8 +60,8 @@ func (s *fileSpec) Load() error {
return nil
}
// loadFrom reads the contents of the OCI spec from the specified io.Reader.
func loadFrom(reader io.Reader) (*specs.Spec, error) {
// LoadFrom reads the contents of the OCI spec from the specified io.Reader.
func LoadFrom(reader io.Reader) (*specs.Spec, error) {
decoder := json.NewDecoder(reader)
var spec specs.Spec

View File

@@ -44,7 +44,7 @@ func TestLoadFrom(t *testing.T) {
for i, tc := range testCases {
var spec *specs.Spec
spec, err := loadFrom(bytes.NewReader(tc.contents))
spec, err := LoadFrom(bytes.NewReader(tc.contents))
if tc.isError {
require.Error(t, err, "%d: %v", i, tc)