8000 go-command subshells do not honor the environment · Issue #444 · dominikh/go-mode.el · GitHub
[go: up one dir, main page]

Skip to content
8000

go-command subshells do not honor the environment #444

Open

Description

@brianmcgillion

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0