-
Notifications
You must be signed in to change notification settings - Fork 862
fix: correct handling of ASDF_FORCE_PREPEND
environment variable
#2011
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
Conversation
The error occurs if I set "yes" to `FORCE_PREPEND` env as described in the documentation. Error message: ``` strconv.ParseBool: parsing \"yes\": invalid syntax ``` Referenced Documents: - https://github.com/asdf-vm/asdf/blob/7352bf4890143184ba419392ca5e6204167c8306/docs/manage/configuration.md#asdf_force_prepend
654ba96
to
82c9dc0
Compare
…ironment variable Those test cases aims to check whether `ForcePrepend` was actually set to the correct/expected value. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/7352bf4890143184ba419392ca5e6204167c8306/docs/manage/configuration.md#asdf_force_prepend
559004e
to
b017252
Compare
If the `ASDF_FORCE_PREPEND` environment variable is not set on macOS, the behavior is the same as when "yes" is set. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/7352bf4890143184ba419392ca5e6204167c8306/docs/manage/configuration.md#asdf_force_prepend
`ASDF_FORCE_PREPEND` is a specification that changes behavior depending on whether the string is "yes" or not. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/7352bf4890143184ba419392ca5e6204167c8306/docs/manage/configuration.md#asdf_force_prepend
b017252
to
934f15d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
@@ -59,8 +61,13 @@ type Settings struct { | |||
} | |||
|
|||
func defaultConfig(dataDir, configFile string) *Config { | |||
forcePrepend := forcePrependDefault | |||
forcePrependEnv := os.Getenv("ASDF_FORCE_PREPEND") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to be able to handle inconsistent case here. Some folks might set this to YES
by mistake and I think that should be handled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it means case-insensitive. Sounds good to me.
I'll try to write a commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @machupicchubeta ! I really appreciate the added tests!
ASDF_FORCE_PREPEND
environment variable
@andrecloutier @Stratus3D |
ASDF_FORCE_PREPEND
environment variableASDF_FORCE_PREPEND
environment variable
ASDF_FORCE_PREPEND
environment variableASDF_FORCE_PREPEND
environment variable
I agree that it would be valid even if it is set in uppercase as well as lowercase. @Stratus3D commented: - asdf-vm#2011 (comment) > We might want to be able to handle inconsistent case here. Some folks might set this to YES by mistake and I think that should be handled.
I agree that it would be valid even if it is set in uppercase as well as lowercase. @Stratus3D commented: - asdf-vm#2011 (comment) > We might want to be able to handle inconsistent case here. Some folks might set this to `YES` by mistake and I think that should be handled.
Previously, the value of `ForcePrepend` was not used anywhere and was not behaving as specified. With this commit, the behavior will be as specified. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/932ac468b7c24c2adef90a293a1f7280a0074cc4/docs/manage/configuration.md#asdf_force_prepend Background: @andrecloutier told about this issue me in a comment on another PullRequest. Thank you! - asdf-vm#2011 (comment)
Previously, the value of `ForcePrepend` was not used anywhere and was not behaving as specified. With this commit, the behavior will be as specified. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/932ac468b7c24c2adef90a293a1f7280a0074cc4/docs/manage/configuration.md#asdf_force_prepend Background: @andrecloutier told about this issue me in a comment on another PullRequest. Thank you! - asdf-vm#2011 (comment)
Previously, the value of `ForcePrepend` was not used anywhere and was not behaving as specified. With this commit, the behavior will be as specified. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/932ac468b7c24c2adef90a293a1f7280a0074cc4/docs/manage/configuration.md#asdf_force_prepend Background: @andrecloutier told about this issue me in a comment on another PullRequest. Thank you! - asdf-vm#2011 (comment)
Previously, the value of `ForcePrepend` was not used anywhere and was not behaving as specified. With this commit, the behavior will be as specified. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/932ac468b7c24c2adef90a293a1f7280a0074cc4/docs/manage/configuration.md#asdf_force_prepend Background: @andrecloutier told about this issue me in a comment on another PullRequest. Thank you! - asdf-vm#2011 (comment)
Previously, the value of `ForcePrepend` was not used anywhere and was not behaving as specified. With this commit, the behavior will be as specified. BREAKING CHANGE: So far, `ASDF_FORCE_PREPEND` environment variable setting has been ignored, but this commit may change the behavior depending on the setting. If it is not set, macOS behavior will not change, but Linux behavior will change. If you want to get the same behavior as before, it is recommended to set the relevant environment variable. Referenced Documents: - https://github.com/asdf-vm/asdf/blob/932ac468b7c24c2adef90a293a1f7280a0074cc4/docs/manage/configuration.md#asdf_force_prepend Background: @andrecloutier told about this issue me in a comment on another PullRequest. Thank you! - asdf-vm#2011 (comment)
I agree that it would be valid even if it is set in uppercase as well as lowercase. @Stratus3D commented: - asdf-vm#2011 (comment) > We might want to be able to handle inconsistent case here. Some folks might set this to `YES` by mistake and I think that should be handled.
Summary
The error occurs if I set "yes" to
FORCE_PREPEND
env as described in the documentation.Error message
Other Information
Referenced Documents