package bazel import ( "os" "path/filepath" "github.com/bazelbuild/rules_go/go/runfiles" ) // Rlocation simplifies the process for retrieving runfiles at runtime via // `bazel run` or in a container runtime. func Rlocation(path string) (string, error) { if ws := os.Getenv(BuildWorkspaceDir); ws != "" { return runfiles.Rlocation(filepath.Join(ws, path)) } if ws := os.Getenv(TestWorkspace); ws != "" { return runfiles.Rlocation(filepath.Join(ws, path)) } return runfiles.Rlocation(filepath.Join(RootRepoName, path)) }