I install go by snap, the path to executable file of go is not in environment variable path, but when I use

go run test.go

in terminal (from my home directory), go still work.

As my understand, the path to executable file of go must in environment variable path, so linux can find where it is and run it. In this case, how Linux find where executable file of go is?

Here is my path variable (in file /etc/environment)


And here is path to executable file of go:


I use linux mint xfce 18.3

1 Answer 1


Your actual $PATH is probably different than the on in /etc/environment. Check this by typing echo $PATH in the terminal. It probably includes /snap/bin, and this directory probably has a symbolic link to the go executable. I have Ubuntu rather than Linux Mint, but on my system the $PATH gets updated by /etc/profile.d/apps-bin-path.sh with this line:

export PATH=$PATH:${snap_bin_path}
  • After echo $PATH, I see /snap/bin, but the symbolic link not point to go executable, it point to usr/bin/snap. Here, snap is shared library file (I see it when check properties of this file); so what is the shared library file? What is its role, here?
    – ydhhat
    Jan 12, 2019 at 7:41
  • @ydhhat - It would be helpful to see more details, such as the full path of the go symbolic link and the full path that it points to. I don't know the internals of the snap system, but an executable can see the filename that was used to run it, even if it was a symbolic link. One possibility is that the snap shared library file executes the go snap when it sees that it was launched with a go symlink.
    – bitinerant
    Jan 12, 2019 at 17:07
  • the full path of the go symbolic link is /snap/bin/go, and the full path that the symbolic link point to is usr/bin/snap
    – ydhhat
    Jan 13, 2019 at 3:53
  • I create a new question about how this shared library file work. Check out at askubuntu.com/questions/1109351/…
    – ydhhat
    Jan 13, 2019 at 12:08
  • 1
    @ydhhat - Thanks for the additional information. I think it was a good choice to create a separate question about what /usr/bin/snap does and why it's set up that way. So for this question, is it fully answered?
    – bitinerant
    Jan 14, 2019 at 6:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .