From c091e06f5714540da69bf246b468ae3ff43b6597 Mon Sep 17 00:00:00 2001 From: adrian-lin-1-0-0 Date: Sat, 3 Jun 2023 14:14:32 +0800 Subject: [PATCH] Fix: Check for presence of go files Previously, the script only checked for a single .go file using the -f *.go(#qN) condition, resulting in a false negative when multiple .go files were present. This has been fixed by using an array to capture all matching .go files and checking the length of the array. --- bullet-train.zsh-theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bullet-train.zsh-theme b/bullet-train.zsh-theme index d72c4f5..75211a8 100644 --- a/bullet-train.zsh-theme +++ b/bullet-train.zsh-theme @@ -543,7 +543,9 @@ prompt_perl() { # Go prompt_go() { setopt extended_glob - if [[ (-f *.go(#qN) || -d Godeps || -f glide.yaml) ]]; then + go_files=( *.go(#qN) ) + + if [[ ($#go_files -gt 0 || -d Godeps || -f glide.yaml) ]]; then if command -v go > /dev/null 2>&1; then prompt_segment $BULLETTRAIN_GO_BG $BULLETTRAIN_GO_FG $BULLETTRAIN_GO_PREFIX" $(go version | grep --colour=never -oE '[[:digit:]].[[:digit:]]+')" fi