gocode icon indicating copy to clipboard operation
gocode copied to clipboard

emacs company-go: Incorrect GOPATH when using emacs server mode

Open XANi opened this issue 9 years ago • 1 comments

Currently the GOPATH used is from starting emacs daemon which means that if daemon was started before setting GOPATH (say in autostart or started by Alt+F2, or application's menu).

It also makes not see any changes in GOPATH when using emacs via emacsclient altho that is a smaller problem.

I do not know if there is even an option to extract environmental variables from emacsclient invocation but there should be an config option to set if it does not exist, or override GOPATH

XANi avatar Dec 18 '16 15:12 XANi

For set correct env in emacs, I recomend to use the package exec-path-from-shell Here my config

(use-package exec-path-from-shell
  :ensure t
  :defer  2
  :config
  (dolist (var '("GOPATH"  "NVM_BIN"))
    (add-to-list 'exec-path-from-shell-variables var))
  (exec-path-from-shell-initialize))

Set in this form gocode work nice! with emacs in normal and server mode (I use emacs in server mode), I hope this response has not been too late Cheers!

marcelino-m avatar Jul 28 '17 04:07 marcelino-m