-
Notifications
You must be signed in to change notification settings - Fork 563
[issue-477] Allow unprefixed go versions #497
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
base: master
Are you sure you want to change the base?
[issue-477] Allow unprefixed go versions #497
Conversation
if [[ "${_line}" = go* ]]; then | ||
version="${_line}" | ||
else | ||
# if the version is not prefixed with "go" add it |
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.
just an icing on the cake - should we print the fact that we've added prefix?
Any updates on this PR? |
if [[ "${_line}" = go* ]]; then | ||
version="${_line}" | ||
else | ||
# if the version is not prefixed with "go" add it | ||
version="go${_line}" | ||
fi |
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.
if [[ "${_line}" = go* ]]; then | |
version="${_line}" | |
else | |
# if the version is not prefixed with "go" add it | |
version="go${_line}" | |
fi | |
version="go${_line#go}" |
@@ -181,15 +181,20 @@ __gvmp_find_closest_dot_go_pkgset() { | |||
__gvmp_read_dot_go_version() { | |||
local filepath="${1}" | |||
local version="" | |||
local regex='^(go([0-9]+(\.[0-9]+)*))$' | |||
local regex='^((go)?([0-9]+(\.[0-9]+)*))$' | |||
|
|||
while IFS=$'\n' read -r _line; do | |||
# skip comment lines | |||
[[ "${_line}" =~ \#.* ]] && continue | |||
|
|||
# looking for pattern "go1.2[.3]" |
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.
# looking for pattern "go1.2[.3]" | |
# looking for pattern "[go]1.2[.3]" |
This repository hasn't been updated for a long time. I have maintained a forked version myself gvm. You can try this one. |
Fixes #477.
This allows
.go-version
files to not have thego
prefix. Now it is possible to have a.go-version
file containing1.22.8
.Discussion: