-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.envrc
More file actions
38 lines (29 loc) · 1.13 KB
/
.envrc
File metadata and controls
38 lines (29 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Users of direnv can run `direnv allow .` here to automatically update the
# GOPATH to whatever directory this repository is cloned into, whenever they
# enter this directory or any descendent. https://direnv.net/
# record the prior Go binary path (for later usage in bin/go as an escape hatch
# when $USE_SYSTEM_GO is set)
SYSTEM_GO=$(command -v go)
export SYSTEM_GO
# eliminate any user custom $GOPATH, since the stdlib `layout go` merely prepends
GOPATH=$(pwd)
export GOPATH
# reduce unnecessary calls in the scripts to resolve WORKSPACE_ROOT
WORKSPACE_ROOT=$(pwd)
export WORKSPACE_ROOT
# prioritize tools/bazel over system installed. `tools/bazel` is a standard
# location where a locally installed Bazel binary will first look for.
PATH_add tools
# Check the Python 3 is installed.
if ! has python3; then
echo "ERROR: Python 3 is not installed. Please install it."
exit 1
fi
# Minimum Python version required for Python-based tools, e.g., ./tools/sandbox.py
python_version=3.9
# Check the minimum Python version
if ! ./tools/assert_python_version.py $python_version; then
exit 1
fi
source_env_if_exists .envrc.local