Skip to content

Commit 4bb94e2

Browse files
committed
use: Nest module file path tests
It's slightly wasteful to keep issuing `-f "$__go_module_file"` checks after finding a valid file path.
1 parent 92bc468 commit 4bb94e2

File tree

1 file changed

+9
-7
lines changed
  • lib/internal

1 file changed

+9
-7
lines changed

lib/internal/use

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,15 @@ for __go_module_name in "$@"; do
8585
if [[ ! -f "$__go_module_file" ]]; then
8686
# Convert <plugin>/<module> to plugins/<plugin>/lib/<module>
8787
__go_module_file="$_GO_SCRIPTS_DIR/plugins/${__go_module_name/\///lib/}"
88-
fi
89-
if [[ ! -f "$__go_module_file" ]]; then
90-
__go_module_file="$_GO_SCRIPTS_DIR/lib/$__go_module_name"
91-
fi
92-
if [[ ! -f "$__go_module_file" ]]; then
93-
@go.printf "ERROR: Unknown module: $__go_module_name" >&2
94-
exit 1
88+
89+
if [[ ! -f "$__go_module_file" ]]; then
90+
__go_module_file="$_GO_SCRIPTS_DIR/lib/$__go_module_name"
91+
92+
if [[ ! -f "$__go_module_file" ]]; then
93+
@go.printf "ERROR: Unknown module: $__go_module_name" >&2
94+
exit 1
95+
fi
96+
fi
9597
fi
9698

9799
if ! . "$__go_module_file"; then

0 commit comments

Comments
 (0)