8000 [issue-477] Allow unprefixed go versions by CelianR · Pull Request #497 · moovweb/gvm · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

CelianR
Copy link
@CelianR CelianR commented Dec 2, 2024

Fixes #477.

This allows .go-version files to not have the go prefix. Now it is possible to have a .go-version file containing 1.22.8.

Discussion:

When .go-version file contains go version without go (e.g. 1.22, instead of go1.22), cd-ing into this directory prints error
Unrecognized command line argument: ''
We should consider allowing version without the prefix go in the regex

if [[ "${_line}" = go* ]]; then
version="${_line}"
else
# if the version is not prefixed with "go" add it

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?

@ericywl
Copy link
ericywl commented Feb 11, 2025

Any updates on this PR?

Comment on lines +192 to +197
if [[ "${_line}" = go* ]]; then
version="${_line}"
else
# if the version is not prefixed with "go" add it
version="go${_line}"
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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]"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# looking for pattern "go1.2[.3]"
# looking for pattern "[go]1.2[.3]"

@cndoit18
Copy link

This repository hasn't been updated for a long time. I have maintained a forked version myself gvm. You can try this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

gvm cd fails with Unrecognized command line argument: ''
4 participants
0