xref: /aosp_15_r20/external/bazelbuild-rules_go/tests/bcr/go_version_test.sh (revision 9bb1b549b6a84214c53be0924760be030e66b93a)
1#!/usr/bin/env bash
2
3# --- begin runfiles.bash initialization v3 ---
4# Copy-pasted from the Bazel Bash runfiles library v3.
5set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
6source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
7  source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
8  source "$0.runfiles/$f" 2>/dev/null || \
9  source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
10  source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
11  { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
12# --- end runfiles.bash initialization v3 ---
13
14GO_TOOL=$(rlocation "$GO_TOOL_RLOCATION")
15# Set runfiles variables for subprocess.
16runfiles_export_envvars
17# Simulate a bazel run environment.
18export BUILD_WORKING_DIRECTORY=$(pwd)
19[[ "$("$GO_TOOL" version)" =~ ^go ]]
20