Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go-command subshells do not honor the environment #444

Open
brianmcgillion opened this issue Dec 30, 2024 · 0 comments
Open

go-command subshells do not honor the environment #444

brianmcgillion opened this issue Dec 30, 2024 · 0 comments

Comments

@brianmcgillion
Copy link

Hi @dominikh. Thanks for all the great work!

I ran into an issue when using go-imports-add that the 'go' command was not found. This is because in my case I use direnv to setup the environment on a per-project basis, so when the subshell is launched to run the go-command it will not find it in the global path.

The solution was to add the following to my config, as they covered all cases of go-command being called in go-mode.el

(use-package! inheritenv
  :config
  ;; ensure that the environment is carried over to the subshell that is called.
  ;; this was tested against go-mode specifically go-import-add
  (inheritenv-add-advice #'process-lines)
  (inheritenv-add-advice #'shell-command-to-string))

https://github.com/purcell/inheritenv suggests that this could also be set within the library. I know that you are doing a large rewrite at the moment, but I was wondering if it is something that you would consider including in the rewrite? It was not obvious why most of the functionality was working, but these few commands were failing to find the binary in the PATH.

Even without direnv integration, it will still use the main env that the user has running, so it will be a nondestructive change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant