From 491950e57d24670ddb11741c3d8f4f21f61ef909 Mon Sep 17 00:00:00 2001 From: Dietrich Epp Date: Wed, 23 Mar 2022 12:00:18 -0400 Subject: [PATCH] Allow data generator to be run directly from Bazel When run from Bazel without additional arguments, it will write data files directly to the source directory. --- gen/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gen/main.go b/gen/main.go index 2196355..f080199 100644 --- a/gen/main.go +++ b/gen/main.go @@ -26,6 +26,10 @@ func getSrcdir() (string, error) { if flagSrc != "" { return flagSrc, nil } + workspace := os.Getenv("BUILD_WORKSPACE_DIRECTORY") + if workspace != "" { + return workspace, nil + } exe, err := os.Executable() if err != nil { return "", err