You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
k3s/pkg/agent/util/file.go

19 lines
314 B

package util
import (
"io/ioutil"
"os"
"path/filepath"
"github.com/pkg/errors"
)
func WriteFile(name string, content string) error {
os.MkdirAll(filepath.Dir(name), 0755)
err := ioutil.WriteFile(name, []byte(content), 0644)
if err != nil {
return errors.Wrapf(err, "writing %s", name)
}
return nil
}