You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just started using Zsh, not to mention oh-my-zsh, so please excuse me if I make a mistake triaging this issue. I was trying to get the Go prompt working for bullet-train (great theme by the way!), and I just couldn't. It turns out the logic that detects whether to use a Go prompt appears to be incorrect and incomplete:
$ { [[ -n*.go(#qN) ]] && echo 'go source(s) detected!'; } || echo 'no go :('
go source(s) detected!
Oh, and just to prove -n works in the other cases:
# Remove world.go and expect a positive message
$ rm world.go && { [[ -n*.go(#qN) ]] && echo 'go source(s) detected!'; } || echo 'no go :('
go source(s) detected!# Remove hello.go and expect a negative message
$ rm hello.go && { [[ -n*.go(#qN) ]] && echo 'go source(s) detected!'; } || echo 'no go :('
no go :(
Yep, works :)
Issue 2 - Go Modules
Finally, it looks like y'all don't yet support Go modules for detection. The detection line should be updated as follows (with the fix for the s/-f/-n/:
if [[ (-n *.go(#qN) || -d Godeps || -f glide.yaml || -f go.mod) ]]; then
Thanks!
The text was updated successfully, but these errors were encountered:
I addressed some of these issues in #317, although in my own fork, I removed the glob for Go sources entirely, so I didn't commit a fix for that first.
If you want to keep the glob, I could make a commit on the branch for that PR that fixes it (doesn't hurt anyone after all), although I would probably discard that commit for the merge back into my own master.
Hi,
I just started using Zsh, not to mention oh-my-zsh, so please excuse me if I make a mistake triaging this issue. I was trying to get the Go prompt working for bullet-train (great theme by the way!), and I just couldn't. It turns out the logic that detects whether to use a Go prompt appears to be incorrect and incomplete:
Issue 1 - Glob Glob
Here's what I mean:
Create a temporary directory:
Enable extended glob:
Test for go sources:
Create a file that ends with
.go
:Test for go sources again:
Create a second file that ends with
.go
:Test for go sources again:
So why does the above fail? Because the
-f
operator does not work against multiple operands:Instead
zsh
indicates to use the-n
operator for detecting multiple files:Oh, and just to prove
-n
works in the other cases:Yep, works :)
Issue 2 - Go Modules
Finally, it looks like y'all don't yet support Go modules for detection. The detection line should be updated as follows (with the fix for the
s/-f/-n/
:Thanks!
The text was updated successfully, but these errors were encountered: