GVM v2.0.0 uses a configuration file at:
$GVM_ROOT/config/gvm.conf
Typically: ~/.gvm/config/gvm.conf
Default Go version to use when no version is specified.
Example:
GVM_DEFAULT_GO_VERSION="go1.21.0"Default: (empty - uses system default)
Base URL for downloading Go binaries.
Example:
GVM_BINARY_BASE_URL="https://go.dev/dl"Default: https://go.dev/dl
Note: Can use a mirror if needed.
Source repository URL for Go source code.
Example:
GVM_SOURCE_URL="https://github.com/golang/go"Default: https://github.com/golang/go
Number of days to retain log files before automatic cleanup.
Example:
GVM_LOG_RETENTION_DAYS="30"Default: 30
Enable automatic cleanup of old logs and cache.
Values: true, false
Example:
GVM_AUTO_CLEANUP="true"Default: true
Enable caching of version lists and metadata.
Values: true, false
Example:
GVM_CACHE_ENABLED="true"Default: true
Cache time-to-live in seconds.
Example:
GVM_CACHE_TTL="3600"Default: 3600 (1 hour)
Edit the configuration file directly:
nano ~/.gvm/config/gvm.confIn scripts, use configuration functions:
# Get a value
default_version=$(gvm_get_config default_go_version "go1.21.0")
# Set a value
gvm_set_config default_go_version "go1.21.0"Environment variables still work and override configuration file values:
export GVM_BINARY_BASE_URL="https://mirror.example.com/go/dl"
export GVM_CACHE_ENABLED="false"- Environment variables (highest priority)
- Configuration file (
gvm.conf) - Default values (lowest priority)
Complete example gvm.conf:
# GVM Configuration File
# Default Go version
GVM_DEFAULT_GO_VERSION="go1.21.0"
# Download URLs
GVM_BINARY_BASE_URL="https://go.dev/dl"
GVM_SOURCE_URL="https://github.com/golang/go"
# Logging
GVM_LOG_RETENTION_DAYS="30"
GVM_AUTO_CLEANUP="true"
# Caching
GVM_CACHE_ENABLED="true"
GVM_CACHE_TTL="3600"Configuration is automatically loaded when GVM starts. To reload:
source ~/.gvm/scripts/gvmOr restart your terminal session.