I installed Golang into a custom folder under $HOME called .go/exec. After the installation, it put the binary under $HOME/.go/exec/go.
So I updated $PATH to contain this directory: $HOME/.go/exec:$PATH.
Here is the question:
When I execute a command by entering the path manually, it works without any issues:
~/.go/exec/go/bin/go version
However, with $PATH it does not work:
go version
# zsh: permission denied: go
I am logged in with $USER, and seems like permissions are set correctly. Here is a namei output:
pwd
# /home/user
namei -olm ./.go/exec/go/bin/go
drwxr-x--- user user .
drwxrwxr-x user user .go
drwxrwxr-x user user exec
drwxr-xr-x user user go
drwxr-xr-x user user bin
-rwxr-xr-x user user go
Could anyone guide me where the issue is?
I thought just adding the top directory to $PATH should have been enough, am I wrong?
$PATHthe bin folder$HOME/.go/exec/go/bininstead of$HOME/.go/exec$PATHresolution. Adding thebinto the path solved the issue.zsh: permission denied: go. Thanks a lot for explaining the differences between the two! I will update the question to prevent confusion.gois actually resolving to withwhence go(orwhich goorwhere gowhich are aliases forwhencewith flags). This would have revealed the problem with your PATH variable.