mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 14:54:19 +01:00
Change io/ioutil to io/os packages because io/ioutil package is deprecated from 1.16: Discard => io.Discard NopCloser => io.NopCloser ReadAll => io.ReadAll ReadDir => os.ReadDir ReadFile => os.ReadFile TempDir => os.MkdirTemp TempFile => os.CreateTemp WriteFile => os.WriteFile Details: https://go.dev/doc/go1.16#ioutil Fixes: #3265 Signed-off-by: bin <bin@hyper.sh>
27 lines
436 B
Go
27 lines
436 B
Go
// Copyright (c) 2019 SUSE LLC
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/pkg/errors"
|
|
"gopkg.in/yaml.v2"
|
|
)
|
|
|
|
func yamlUnmarshal(yamlFile string, cfg interface{}) error {
|
|
source, err := os.ReadFile(yamlFile)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
err = yaml.Unmarshal(source, cfg)
|
|
if err != nil {
|
|
return errors.Wrapf(err, fmt.Sprintf("cannot unmarshal %s", yamlFile))
|
|
}
|
|
return nil
|
|
}
|