Files
kata-containers/tools/packaging/cmd/kata-pkgsync/cli/utils.go
Peng Tao 782cd2ed10 packaging: merge packaging repository
git-subtree-dir: tools/packaging
git-subtree-mainline: f818b46a41
git-subtree-split: 1f22d72d5d

Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2020-06-23 22:58:18 -07:00

27 lines
447 B
Go

// Copyright (c) 2019 SUSE LLC
//
// SPDX-License-Identifier: Apache-2.0
//
package main
import (
"fmt"
"io/ioutil"
"github.com/pkg/errors"
"gopkg.in/yaml.v2"
)
func yamlUnmarshal(yamlFile string, cfg interface{}) error {
source, err := ioutil.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
}