I am writing a utility function for my unit tests which is used by unit tests in multiple packages. This utility function must read a particular file (always the same file). Her
Returns the root of the application:
import ( "path" "path/filepath" "runtime" ) func RootDir() string { _, b, _, _ := runtime.Caller(0) d := path.Join(path.Dir(b)) return filepath.Dir(d) }