You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Something like sdkman or nvm to avoid compatibility problems with packages and in production softwares.
maybe: v.mod
Module {
name: 'v2048',
description: 'A simple 2048 game written in V.',
version: '0.0.2',
license: 'MIT'
repo_url: 'https://github.com/spytheman/v2048',
dependencies: [],
+ v_version: '>= 0.4.6 && <= weekly.2024.23'
or
+ v_version: 'latest'
}
.vvmrc
0.4.6
or
latest
Use Case
Build to production
Proposed Solution
When running v <project> or v run <project> it must the get the version in .vvmrc (if it exists), and then run the project with that version of V.
If the version is not found in .vvmrc then it should use the latest version of V installed on the system or the in use version of V.
If the version in .vvmrc is not installed on the system, it should install that version and then run the project with that version of V,
Maybe installing it at /usr/lib/v/<version>/bin/v and/or /usr/local/bin/v<version>.
Other Information
It is need verify if will need have some change how vlib/v/util/version/version.v, cmd/tools/vup.v and @VCURRENTHASH works.
#!/bin/bash# Function to print an error message and exitfunctionerror_exit {
echo"$1"1>&2exit 1
}
# Function to get the latest installed version of Vfunctionget_latest_installed_version {
local latest_version=$(ls /usr/lib/v | sort -V | tail -n 1)if [[ -z"$latest_version" ]];then
error_exit "No V versions found. Please install V."fiecho"$latest_version"
}
# Function to install the specified version of Vfunctioninstall_v_version {
local version=$1echo"Installing V version $version..."
wget "https://github.com/vlang/v/releases/download/$version/v_linux.zip" -O /tmp/v-$version.zip
mkdir -p "/usr/lib/v/$version/bin"
unzip -jo /tmp/v-$version.zip v/v -d /usr/lib/v/$version/bin
ln -sf "/usr/lib/v/$version/bin/v""/usr/local/bin/v$version"
}
# Determine the project directory
PROJECT_DIR=$(pwd)if [[ -z"$1" ]];then
error_exit "Please specify a project directory or file."fi# Check if the specified argument is a directory or fileif [[ -d"$1" ]];then
PROJECT_DIR="$1"elif [[ -f"$1" ]];then
PROJECT_DIR=$(dirname "$1")else
error_exit "Invalid project directory or file specified."fi# Look for .vvmrc file
VVMRC_FILE="$PROJECT_DIR/.vvmrc"if [[ -f"$VVMRC_FILE" ]];then
V_VERSION=$(cat "$VVMRC_FILE"| tr -d '[:space:]')else
V_VERSION=$(get_latest_installed_version)fi# Check if the specified version is installedif [[ !-x"/usr/lib/v/$V_VERSION/bin/v" ]];then
install_v_version "$V_VERSION"fi# Run the project with the specified version of V
/usr/lib/v/$V_VERSION/bin/v "$@"
I am still against adding things like this until 1.0 or after.
At present, people are still better off always using the latest version of V, even if there was a change that means they need to update their code - often those changes are necessary to avoid more serious issues.
Describe the feature
Something like
sdkman
ornvm
to avoid compatibility problems with packages and in production softwares.maybe:
v.mod
.vvmrc
or
Use Case
Build to production
Proposed Solution
When running
v <project>
orv run <project>
it must the get the version in.vvmrc
(if it exists), and then run the project with that version of V.If the version is not found in
.vvmrc
then it should use the latest version of V installed on the system or the in use version of V.If the version in
.vvmrc
is not installed on the system, it should install that version and then run the project with that version of V,Maybe installing it at
/usr/lib/v/<version>/bin/v
and/or/usr/local/bin/v<version>
.Other Information
It is need verify if will need have some change how vlib/v/util/version/version.v, cmd/tools/vup.v and
@VCURRENTHASH
works.Acknowledgements
Version used
V 0.4.6 209063f
Environment details (OS name and version, etc.)
all
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: