Skip to content

Commit 0dfd336

Browse files
committed
Go: fix //go:gen on windows
1 parent b0758fd commit 0dfd336

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

go/gen.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
import sys
22
import pathlib
33
import subprocess
4+
import os
45
from python.runfiles import runfiles
56

6-
this = pathlib.Path(__file__).resolve()
7-
go_extractor_dir = this.parent / "extractor"
8-
go_dbscheme = this.parent / "ql" / "lib" / "go.dbscheme"
7+
try:
8+
workspace_dir = pathlib.Path(os.environ['BUILD_WORKSPACE_DIRECTORY'])
9+
except KeyError:
10+
print("this should be run with bazel run", file=sys.stderr)
11+
sys.exit(1)
12+
13+
go_extractor_dir = workspace_dir / "go" / "extractor"
14+
go_dbscheme = workspace_dir / "go" / "ql" / "lib" / "go.dbscheme"
915
r = runfiles.Create()
1016
go, gazelle, go_gen_dbscheme = map(r.Rlocation, sys.argv[1:])
1117

0 commit comments

Comments
 (0)