driftctl/test/files.go

18 lines
374 B
Go

package test
import (
"io/ioutil"
"path"
"runtime"
)
func WriteTestFile(p string, content []byte) error {
_, filename, _, _ := runtime.Caller(1)
return ioutil.WriteFile(path.Join(path.Dir(filename), p), content, 0644)
}
func ReadTestFile(p string) ([]byte, error) {
_, filename, _, _ := runtime.Caller(1)
return ioutil.ReadFile(path.Join(path.Dir(filename), p))
}