Skip to content

Commit

Permalink
Merge cca38a8 into b8d7140
Browse files Browse the repository at this point in the history
  • Loading branch information
nkakouros authored Dec 12, 2017
2 parents b8d7140 + cca38a8 commit 5db487c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
11 changes: 7 additions & 4 deletions go-core.bash
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ declare -r -x _GO_CORE_DIR="$PWD"
# Set _GO_STANDALONE if your script is a standalone program.
#
# See the "Standalone mode" section of README.md for more information.
if [[ -z "$_GO_STANDALONE" ]]; then
if [[ "${_GO_STANDALONE:-null}" == "null" ]]; then
cd "$_GO_ROOTDIR" || exit 1
else
cd "$__go_orig_dir" || exit 1
Expand Down Expand Up @@ -120,7 +120,7 @@ declare -r -x _GO_TEST_DIR="${_GO_TEST_DIR:-tests}"
declare -r -x _GO_SCRIPT="$_GO_ROOTDIR/${0##*/}"

# The name of either the ./go script itself or the shell function invoking it.
declare -r -x _GO_CMD="${_GO_CMD:=$0}"
declare -r -x _GO_CMD="${_GO_CMD:-$0}"

# The array of command line arguments comprising the ./go command name after
# _GO_CMD.
Expand Down Expand Up @@ -151,11 +151,14 @@ declare _GO_SEARCH_PATHS=()
# Should be an absolute path. Use this for stubbing out scripts during testing
# or debugging, or for experimenting with new implementations of existing
# scripts.
declare _GO_INJECT_SEARCH_PATH="$_GO_INJECT_SEARCH_PATH"
declare _GO_INJECT_SEARCH_PATH="${_GO_INJECT_SEARCH_PATH-}"

# Directory to search for module scripts first.
# Similar to _GO_INJECT_SEARCH_PATHS above, but for `. "$_GO_USE_MODULES"`.
declare _GO_INJECT_MODULE_PATH="$_GO_INJECT_MODULE_PATH"
declare _GO_INJECT_MODULE_PATH="${_GO_INJECT_MODULE_PATH-}"

# Read from the environment and used in output formatting
COLUMNS="${COLUMNS-}"

# Invokes printf builtin, then folds output to $COLUMNS width
#
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/set-search-paths
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ _@go.set_search_paths() {
# A plugin's own local plugin paths will appear before inherited ones. If
# there is a version incompatibility issue with other installed plugins, this
# allows a plugin's preferred version to take precedence.
@go.search_plugins '_@go.set_search_paths_add_plugin_paths'
@go.search_plugins '_@go.set_search_paths_add_plugin_paths' || :
_GO_SEARCH_PATHS+=("${_GO_PLUGINS_PATHS[@]}")
}

Expand Down
8 changes: 7 additions & 1 deletion libexec/env
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,13 @@ END_OF_HELP
return 1
fi

read -r -d '' env_script < "$shell_impl"
read -r -d '' env_script < "$shell_impl" && exit_code=0 || exit_code=$?
if [[ "$exit_code" -gt 1 ]]; then
# Due to encountering EOL, 'read' will return with '1'. To support 'set -e'
# we only return the exit code if an actual error has occured ($? -gt 1).
return $exit_code
fi

env_script="${env_script//_go_func/$go_func}"
env_script="${env_script//\$_GO_ROOTDIR/$_GO_ROOTDIR}"
echo "${env_script//\$_GO_SCRIPT/$_GO_SCRIPT}"
Expand Down

0 comments on commit 5db487c

Please sign in to comment.