Skip to content

bug: Missing environment variables in the exec-env script for plugins #1924

@darthShadow

Description

@darthShadow

Describe the Bug

Following from #1876, would it be possible to also pass the environment variables to the exec-env script too?

I know it's not documented or supported, but there are quite a few plugins relying on the passthrough of environment variables.

Plugins relying on such behaviour:

https://github.com/search?q=org%3Aasdf-community+path%3Aexec-env++%22%24%7B%22+OR+%22-z%22+OR+%22unset%22&type=code

https://github.com/search?q=org%3Aasdf-vm+path%3Aexec-env+%22%24%7B%22+OR+%22-z%22+OR+%22unset%22&type=code

The follow is an example for the Golang plugin.

Steps to Reproduce

  1. Install the Golang Plugin
  2. Set the GOPATH
  3. Install the latest version of Golang
  4. Run go env

Expected Behaviour

GOPATH should be preserved.

Actual Behaviour

GOPATH is overridden (because of https://github.com/asdf-community/asdf-golang/blob/e2527a31714da7bc671a684308579f4ef8863281/bin/exec-env#L8-L10)

Environment

OS:
Darwin Darth-MBP.local 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:16 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6000 arm64

SHELL:
fish, version 3.7.1

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
0.16.1

ASDF INTERNAL VARIABLES:
ASDF_DEFAULT_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/darthshadow/.asdf
ASDF_CONFIG_FILE=/Users/darthshadow/Personal/dotfiles/asdf/.asdfrc

ASDF INSTALLED PLUGINS:
golang    https://github.com/asdf-community/asdf-golang.git e2527a31714da7bc671a684308579f4ef8863281
python    https://github.com/asdf-community/asdf-python.git a3a01856098d6d2b9642e382f5b38e70275726d1
ruby      https://github.com/asdf-vm/asdf-ruby.git          98e32b9c38e146b164d651c96ccb6d5fa4c3af90

asdf plugins affected (if relevant)

golang

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions