Removes usage of library methods that are not available in 1.11 #74

Merged
sloum merged 1 commits from remove-replace-all into develop 2019-11-04 05:51:26 +00:00
Owner

It turns out that two methods being used (strings.ReplaceAll and os.UserHomeDir) are only available for 1.12+. Since I was hoping to support 1.11, which is what we have in the readme and mod file, I updated the code to use alternate methods.

In the case of ReplaceAll I looked at the 1.12 source code and ReplaceAll is just a wrapper for Replace that lets you avoid adding -1 as a param.

For os.UserHomeDir I changed it to use what we were already using in defaults.go: user.Current followed by _.HomeDir (where _ is the return from user.Current).

This should make it build and have the same functionality for Go 1.11 users. I dont think we can realistically support any earlier than that.

I looked around for tooling that would let us know, based on the standard lib methods and other features being used, what versions we support... but was unable to find anything. This may be in part because I do not use google for search (duckduckgo instead) and sometimes cannot get what I am hoping for... but it is also possible that such a thing just doesnt exist.

It turns out that two methods being used (`strings.ReplaceAll` and `os.UserHomeDir`) are only available for 1.12+. Since I was hoping to support `1.11`, which is what we have in the readme and mod file, I updated the code to use alternate methods. In the case of `ReplaceAll` I looked at the 1.12 source code and `ReplaceAll` is just a wrapper for `Replace` that lets you avoid adding `-1` as a param. For `os.UserHomeDir` I changed it to use what we were _already using_ in `defaults.go`: `user.Current` followed by `_.HomeDir` (where `_` is the return from `user.Current`). This should make it build and have the same functionality for Go 1.11 users. I dont think we can realistically support any earlier than that. I looked around for tooling that would let us know, based on the standard lib methods and other features being used, what versions we support... but was unable to find anything. This may be in part because I do not use google for search (duckduckgo instead) and sometimes cannot get what I am hoping for... but it is also possible that such a thing just doesnt exist.
sloum added this to the 2.0.0 milestone 2019-11-04 02:01:40 +00:00
asdf was assigned by sloum 2019-11-04 02:01:40 +00:00
sloum self-assigned this 2019-11-04 02:01:40 +00:00
sloum added the
bug
non-functional
labels 2019-11-04 02:01:40 +00:00
asdf approved these changes 2019-11-04 02:19:36 +00:00
sloum closed this pull request 2019-11-04 05:51:25 +00:00
sloum deleted branch remove-replace-all 2019-11-04 05:51:31 +00:00
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: sloum/bombadillo#74
No description provided.