package test import ( "io/ioutil" "path/filepath" "runtime" "strings" ) func Fixture(path string) string { bytes, err := ioutil.ReadFile(filepath.Join(thisDir(), "fixtures", path)) if err != nil { return "" } return strings.TrimSuffix(string(bytes), "\n") } func thisFile() string { _, thisFile, _, _ := runtime.Caller(0) return thisFile } func thisDir() string { return filepath.Dir(thisFile()) }