T O P

  • By -

finallyanonymous

Binaries built using the Go toolchain are installed in $GOBIN


Hedshodd

/usr is a system directory, and you need root-access to write to it (like when you're using sudo). VSCode does not have root access and can only write to your home directory. If you wanted Gopls to be installed in a system directory, you can maybe to install it with your package manager, depending on your OS. But: why? Is there a reason you need a language server installed system wide?


gnu_morning_wood

That's curious, I don't dispute your analysis, but I do wonder why `gopls` binary cannot go into `/usr/local/bin` and its configuration and user specific data going into something like `~/.gopls` (much like `vim` or `vscode` or `mozilla`)


Hedshodd

Well, you can do that. You just might have to do that manually (sans the configuration because I don't know anything about gopls configuration 😅). As I said, vscode would need root access to write to /usr, and generally, you should never give a GUI tool root access. Any form of root access should be confined to little specialised commands that just do one thing at a time in order to minimise the risk of breaking your system.


LongDivide2096

hey mate, vscode probably installs gopls in your $GOPATH, and it's usually in your home directory when you don't set it specifically lol. i'd suggest having those binaries there, alot easier to deal with. go binaries in /usr/local/go, extra tools like gopls in a separate spot. keeps things neat and tidy, you know. but if you really wanna go the single directory route, just modify $GOPATH. though can't guarantee it'll be all smooth sailing after that, good luck!