This comprehensive guide covers everything you need to know about using Gopher, the Go version manager.
macOS (Homebrew):
brew install molmedoz/tap/gopher
Windows (Chocolatey):
choco install gopher
Linux (Snap):
snap install gopher
Windows:
# Download and install
$version = "1.0.0"
New-Item -ItemType Directory -Path "$env:USERPROFILE\bin" -Force
$url = "https://github.com/molmedoz/gopher/releases/download/v$version/gopher-windows-amd64.exe"
Invoke-WebRequest -Uri $url -OutFile "$env:USERPROFILE\bin\gopher.exe"
# Add to PATH
$userPath = [Environment]::GetEnvironmentVariable("PATH", "User")
[Environment]::SetEnvironmentVariable("PATH", "$env:USERPROFILE\bin;$userPath", "User")
# Restart PowerShell
macOS/Linux:
# Download for your platform
curl -LO https://github.com/molmedoz/gopher/releases/download/v1.0.0/gopher-$(uname -s | tr '[:upper:]' '[:lower:]')-$(uname -m)
chmod +x gopher-*
sudo mv gopher-* /usr/local/bin/gopher
go install github.com/molmedoz/gopher/cmd/gopher@latest
git clone https://github.com/molmedoz/gopher.git
cd gopher
make build
sudo make install
gopher version
Expected output:
gopher v1.0.0
Windows:
gopher init
Then follow the on-screen instructions. See Windows Setup Guide for details.
macOS/Linux:
gopher init
What gopher init does:
Directories created automatically:
C:\Users\YourName\gopher\{versions,downloads,state}$HOME/.gopher/{versions,downloads,state}Here’s a visual overview of common Gopher workflows:
┌─────────────────────────────────────────────────────────────────────┐
│ GOPHER WORKFLOW DIAGRAM │
└─────────────────────────────────────────────────────────────────────┘
First Time Setup:
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ Install │ -> │ Check │ -> │ Install │ -> │ Use │
│ Gopher │ │ System │ │ Go Ver. │ │ Go Ver. │
└──────────┘ └──────────┘ └──────────┘ └──────────┘
(once) gopher system gopher install gopher use
Regular Usage:
┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
│ List │ -> │ Install │ -> │ Switch │ -> │ Verify │
│ Versions │ │ Version │ │ Version │ │ Active │
└──────────┘ └──────────┘ └──────────┘ └──────────┘
gopher list gopher install gopher use go version
Cleanup:
┌──────────┐ ┌──────────┐ ┌──────────┐
│ List │ -> │ Find │ -> │ Uninstall│
│ Installed│ │ Unused │ │ Version │
└──────────┘ └──────────┘ └──────────┘
gopher list gopher uninstall
Current State Action New State
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ System │ │ gopher │ │ go1.21.0 │
│ go1.20.0 │ ---> │ use 1.21.0 │ ---> │ [active] │
│ [active] │ └─────────────┘ └─────────────┘
└─────────────┘ │
↑ │
│ ┌─────────────┐ │
└─────────│ gopher │ <─────────────────────┘
│ use system │
└─────────────┘
# See what Go versions you have
gopher list
# Check your current Go version
gopher current
# View system Go information
gopher system
# Install Go 1.21.0
gopher install 1.21.0
# Verify installation
gopher list
# Switch to a specific version
gopher use 1.21.0
# Switch back to system Go
gopher use system
# Verify the switch
go version
# Remove a specific version you no longer need
gopher uninstall 1.20.7
# Clean download cache to free disk space
gopher clean
# Completely remove all Gopher data (requires confirmation)
gopher purge
gopher listLists all installed Go versions, including system versions. Interactive pagination is enabled by default.
gopher list
Interactive Mode (default):
Output:
Installed Go versions (page 1 of 1, showing 2 of 2 total):
go1.25.1 (darwin/arm64) - active (installed: 2025-08-27 08:49:40) [system]
go1.21.0 (darwin/arm64) - inactive (installed: 2025-08-27 09:15:22)
Page 1 of 1
Commands:
n, next, → - Next page
p, prev, ← - Previous page
<number> - Go to specific page
q, quit, exit - Quit
h, help - Show this help
Enter command:
Options:
--json: Output in JSON format (disables interactive mode)--no-interactive: Disable interactive pagination--page-size <number>: Number of versions per page (default: 10)--page <number>: Page number to display (default: 1)Note: Flags must be placed before the command name.
Examples:
# Interactive mode (default)
gopher list
# Disable interactive mode
gopher --no-interactive list
# JSON output
gopher --json list
# Change page size
gopher --page-size 5 list
# Go to specific page (non-interactive)
gopher --page 2 --no-interactive list
JSON Output:
gopher list --json
[
{
"version": "go1.25.1",
"os": "darwin",
"arch": "arm64",
"installed_at": "2025-08-27T08:49:40-07:00",
"is_active": true,
"is_system": true,
"path": "/opt/homebrew/opt/go/libexec/bin/go"
}
]
gopher list-remoteLists available Go versions for installation. Interactive pagination is enabled by default.
gopher list-remote
Interactive Mode (default):
Output:
Available Go versions (page 1 of 33, showing 10 of 328 total):
go1.25.1 (stable) -
go1.25.0 (stable) -
go1.24.7 (stable) -
...
Page 1 of 33
Commands:
n, next, → - Next page
p, prev, ← - Previous page
<number> - Go to specific page
q, quit, exit - Quit
h, help - Show this help
Enter command:
Options:
--page-size <number>: Number of versions per page (default: 10)--page <number>: Page number to display (default: 1)--filter <text>: Filter versions by text (e.g., ‘1.21’, ‘stable’, ‘rc’)--stable: Show only stable versions--no-interactive: Disable interactive pagination--json: Output in JSON format (disables interactive mode)Note: Flags must be placed before the command name.
Examples:
# Interactive listing (default)
gopher list-remote
# Disable interactive mode
gopher --no-interactive list-remote
# Pagination
gopher --page-size 5 list-remote
gopher --page 2 --page-size 10 --no-interactive list-remote
# Filtering
gopher --filter "1.21" list-remote
gopher --filter "rc" list-remote
gopher --stable list-remote
# JSON output
gopher --json list-remote
gopher install <version>Downloads and installs a specific Go version.
gopher install 1.21.0
Examples:
# Install latest stable
gopher install 1.21.0
# Install with go prefix
gopher install go1.21.0
# Install specific patch version
gopher install 1.21.1
What happens during installation:
gopher uninstall <version>Removes a Go version installed by gopher.
gopher uninstall 1.21.0
Note: Cannot uninstall system Go versions.
gopher use <version>Switches to a specific Go version.
gopher use 1.21.0
gopher use system
Special versions:
system or sys: Switch to system GoWhat happens during switching:
Automatic PATH Check:
After switching, Gopher automatically verifies that $GOPATH/bin is in your PATH. If not, you’ll see a warning with platform-specific fix instructions. This ensures that tools installed via go install are accessible from the command line.
gopher currentShows the currently active Go version.
gopher current
Output:
Current Go version: go1.21.0 (darwin/arm64)
gopher systemShows detailed information about system Go.
gopher system
Output:
System Go Information:
System Go: go version go1.25.1 darwin/arm64
Path: /opt/homebrew/opt/go/libexec/bin/go
GOROOT: /opt/homebrew/opt/go/libexec
GOPATH: /Users/molmedoz/go
Installed: 2025-08-27 08:49:40
System: true
gopher versionShows gopher version information.
gopher version
gopher initRuns the interactive setup wizard for platform-specific configuration.
gopher init
What it does:
Example output:
🚀 Welcome to Gopher Setup Wizard!
Detected system: darwin/arm64
Install directory: /Users/username/.gopher/versions
Download directory: /Users/username/.gopher/downloads
Setting up shell integration...
✓ Shell integration configured for zsh
✓ Configuration saved
gopher setupSets up shell integration for persistent Go version switching.
gopher setup
What it does:
Supported shells:
.bashrc, .bash_profile).zshrc)config.fish)gopher statusShows persistence status and shell integration information.
gopher status
Output:
Gopher Status:
Shell Integration: ✓ Enabled (zsh)
Profile File: /Users/username/.zshrc
Current Version: go1.21.0
Active Version: go1.21.0
System Go: Available
gopher debugShows debug information for troubleshooting.
gopher debug
Output:
Debug Information:
Gopher Version: v1.0.0
Go Version: go1.21.0
OS: darwin
Arch: arm64
Install Dir: /Users/username/.gopher/versions
Download Dir: /Users/username/.gopher/downloads
Config File: /Users/username/.gopher/config.json
Shell: zsh
PATH: /Users/username/.gopher/versions/go1.21.0/bin:/usr/local/bin:...
Useful for:
gopher cleanRemoves the download cache to free up disk space. This command deletes all downloaded Go archive files from ~/.gopher/downloads/ without affecting installed Go versions.
gopher clean
Example Output:
Cleaning download cache...
✓ Successfully cleaned download cache
Freed: 125.3 MB
When to Use:
Note: Downloaded files are only needed during installation. Once a Go version is installed, the download archive is no longer required.
gopher purgeCompletely removes all Gopher data including installed versions, download cache, configuration, state files, and symlinks. This operation requires explicit confirmation and cannot be undone.
gopher purge
Interactive Confirmation:
⚠️ WARNING: This will permanently delete ALL Gopher data:
• All installed Go versions
• Download cache
• Configuration files
• State files and aliases
• Gopher-created symlinks
This operation CANNOT be undone!
Type 'yes' to confirm purge: yes
Purging all Gopher data...
✓ Successfully purged all Gopher data
All Gopher files and directories have been removed.
To use Gopher again, run: gopher init
What Gets Removed:
~/.gopher/ directory (all installed versions)~/.gopher/downloads/)~/.gopher/config.json)/usr/local/bin/go~/.local/bin/go~/bin/goWhen to Use:
Important: After purging, you’ll need to run gopher init to use Gopher again. Your system Go installation (if any) will remain unaffected.
Gopher automatically detects and manages your system-installed Go versions alongside Gopher-managed versions.
Gopher recognizes these system Go installations:
/opt/homebrew/opt/go/libexec/bin/go (Apple Silicon)/usr/local/opt/go/libexec/bin/go (Intel)/usr/bin/go, /usr/local/bin/go/usr/local/go/bin/goC:\Program Files\Go\bin\go.exe, C:\Go\bin\go.exe# Check if system Go is available
gopher system
# Switch to system Go
gopher use system
# List all versions (including system)
gopher list
# Get system Go info in JSON
gopher system --json
Gopher provides comprehensive environment variable management to ensure proper Go development workflows. This section covers GOPATH and GOROOT management, environment configuration, and automatic script generation.
Gopher supports three different GOPATH management strategies to suit different development needs:
Best for: Most users, shared projects, simple setups
All Go versions share the same GOPATH directory, allowing packages to be shared across versions.
# Set shared mode (default)
gopher env set gopath_mode=shared
# Check current configuration
gopher env list
# Switch to a Go version
gopher use 1.21.0
# GOPATH=/home/user/go (shared across all versions)
Advantages:
Disadvantages:
Best for: Development work, testing, complete isolation
Each Go version has its own isolated GOPATH directory.
# Set version-specific mode
gopher env set gopath_mode=version-specific
# Switch to different versions
gopher use 1.21.0
# GOPATH=/home/user/.gopher/versions/go1.21.0/gopath
gopher use 1.22.0
# GOPATH=/home/user/.gopher/versions/go1.22.0/gopath
Advantages:
Disadvantages:
Best for: Specific project requirements, custom workspace setups
Use a custom GOPATH location specified by the user.
# Set custom mode
gopher env set gopath_mode=custom
gopher env set custom_gopath=/path/to/your/workspace
# Switch to a Go version
gopher use 1.21.0
# GOPATH=/path/to/your/workspace
Advantages:
Disadvantages:
# List all configuration options
gopher env list
# Show environment variables for a specific version
gopher env show go1.21.0
# Show environment variables in JSON format
gopher env show go1.21.0 --json
# Set GOPATH mode
gopher env set gopath_mode=version-specific
# Set custom GOPATH (when mode is custom)
gopher env set custom_gopath=/path/to/workspace
# Configure Go proxy
gopher env set goproxy=https://proxy.golang.org,direct
# Configure checksum database
gopher env set gosumdb=sum.golang.org
# Enable/disable environment variable setting
gopher env set set_environment=true
# Reset all configuration to defaults
gopher env reset
When switching Go versions, Gopher automatically generates environment activation scripts that set up all necessary environment variables.
# Switch to a Go version (generates script automatically)
gopher use 1.21.0
# Output:
# ✓ Environment variables configured for Go go1.21.0
# To activate this environment, run:
# source /home/user/.gopher/scripts/go-go1.21.0.env
# Or add the following to your shell profile:
# export GOROOT=/home/user/.gopher/versions/go1.21.0
# export GOPATH=/home/user/go
# export GOPROXY=https://proxy.golang.org,direct
# export GOSUMDB=sum.golang.org
# export PATH=/home/user/.gopher/versions/go1.21.0/bin:...
Environment scripts are stored in ~/.gopher/scripts/:
~/.gopher/scripts/
├── go-go1.21.0.env
├── go-go1.22.0.env
└── go-system.env
Method 1: Source the script
source ~/.gopher/scripts/go-go1.21.0.env
Method 2: Add to shell profile
# Add to ~/.bashrc, ~/.zshrc, etc.
echo 'source ~/.gopher/scripts/go-go1.21.0.env' >> ~/.bashrc
Method 3: Manual export
export GOROOT=/home/user/.gopher/versions/go1.21.0
export GOPATH=/home/user/go
export GOPROXY=https://proxy.golang.org,direct
export GOSUMDB=sum.golang.org
export PATH=/home/user/.gopher/versions/go1.21.0/bin:$PATH
Gopher manages the following environment variables:
| Variable | Description | Example |
|---|---|---|
GOROOT |
Go installation directory | /home/user/.gopher/versions/go1.21.0 |
GOPATH |
Go workspace directory | /home/user/go (shared) or /home/user/.gopher/versions/go1.21.0/gopath (version-specific) |
GOPROXY |
Go module proxy | https://proxy.golang.org,direct |
GOSUMDB |
Go checksum database | sum.golang.org |
PATH |
System PATH with Go binary | /home/user/.gopher/versions/go1.21.0/bin:... |
# Use shared GOPATH for common development
gopher env set gopath_mode=shared
gopher env set set_environment=true
# Install and switch to Go 1.21.0
gopher install 1.21.0
gopher use 1.21.0
# Activate environment
source ~/.gopher/scripts/go-go1.21.0.env
# Verify setup
go version
echo $GOPATH # /home/user/go
# Use version-specific GOPATH for testing
gopher env set gopath_mode=version-specific
gopher env set set_environment=true
# Install multiple Go versions
gopher install 1.21.0
gopher install 1.22.0
# Test with Go 1.21.0
gopher use 1.21.0
source ~/.gopher/scripts/go-go1.21.0.env
go mod init test-project
go get github.com/gin-gonic/gin
# Test with Go 1.22.0 (isolated environment)
gopher use 1.22.0
source ~/.gopher/scripts/go-go1.22.0.env
go mod init test-project # Fresh start, no shared packages
# Use custom GOPATH for specific project
gopher env set gopath_mode=custom
gopher env set custom_gopath=/path/to/my-project
gopher env set set_environment=true
# Switch to Go version
gopher use 1.21.0
# Activate environment
source ~/.gopher/scripts/go-go1.21.0.env
# Verify custom GOPATH
echo $GOPATH # /path/to/my-project
Problem: After switching versions, you see a warning that GOPATH/bin is not in your PATH
What this means:
$GOPATH/bin is not in your PATH environment variablego install) will not be accessible from command lineSolution:
# Gopher automatically shows the fix when this warning appears
# For Unix/Linux/macOS:
export PATH="$GOPATH/bin:$PATH"
# Or add permanently to your shell profile (~/.bashrc, ~/.zshrc):
echo 'export PATH="$GOPATH/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
# For Windows (PowerShell):
$env:PATH = "$env:GOPATH\bin;$env:PATH"
# Or permanently via PowerShell:
[Environment]::SetEnvironmentVariable("PATH", "$env:GOPATH\bin;" + [Environment]::GetEnvironmentVariable("PATH", "User"), "User")
Note: Gopher automatically checks for this issue after every version switch and provides platform-specific instructions.
Problem: Go commands not found after switching versions
Solution:
# Check if environment script exists
ls -la ~/.gopher/scripts/
# Activate environment manually
source ~/.gopher/scripts/go-go1.21.0.env
# Or recreate the environment
gopher use 1.21.0
Problem: GOPATH not set correctly
Solution:
# Check current configuration
gopher env list
# Check environment variables for version
gopher env show go1.21.0
# Reset configuration if needed
gopher env reset
Problem: Cannot source environment script
Solution:
# Check script permissions
ls -la ~/.gopher/scripts/go-go1.21.0.env
# Fix permissions if needed
chmod +x ~/.gopher/scripts/go-go1.21.0.env
# Or use manual export
gopher env show go1.21.0
# Copy and paste the export commands
Gopher stores its configuration in:
~/.gopher/config.json%USERPROFILE%\gopher\config.json{
"install_dir": "~/.gopher/versions",
"download_dir": "~/.gopher/downloads",
"mirror_url": "https://go.dev/dl/",
"auto_cleanup": true,
"max_versions": 5
}
| Option | Description | Default |
|---|---|---|
install_dir |
Directory for Go versions | ~/.gopher/versions |
download_dir |
Temporary download directory | ~/.gopher/downloads |
mirror_url |
Go download mirror URL | https://go.dev/dl/ |
auto_cleanup |
Auto-remove old versions | true |
max_versions |
Maximum versions to keep | 5 |
# Use custom configuration file
gopher --config /path/to/config.json list
# Environment variables
export GOPHER_CONFIG=/path/to/config.json
export GOPHER_INSTALL_DIR=/opt/go-versions
export GOPHER_DOWNLOAD_DIR=/tmp/gopher-downloads
# Create config directory
mkdir -p ~/.gopher
# Create custom config
cat > ~/.gopher/config.json << EOF
{
"install_dir": "/opt/go-versions",
"download_dir": "/tmp/gopher-downloads",
"mirror_url": "https://go.dev/dl/",
"auto_cleanup": true,
"max_versions": 10
}
EOF
All commands support JSON output for scripting:
# Get current version in JSON
current_version=$(gopher current --json | jq -r '.version')
echo "Current Go version: $current_version"
# List versions as JSON
gopher list --json | jq '.[] | select(.is_active) | .version'
# Get system Go path
system_path=$(gopher system --json | jq -r '.path')
echo "System Go path: $system_path"
Add to your shell profile (.bashrc, .zshrc, etc.):
# Auto-switch Go versions based on directory
function cd() {
builtin cd "$@"
if [[ -f .gopher-version ]]; then
gopher use $(cat .gopher-version)
fi
}
# Go version prompt
export PS1='$(gopher current --json | jq -r ".version") $ '
# GitHub Actions example
- name: Setup Go with Gopher
run: |
go install github.com/molmedoz/gopher/cmd/gopher@latest
gopher install 1.21.0
gopher use 1.21.0
echo "$(gopher current --json | jq -r '.path')" >> $GITHUB_PATH
Create .gopher-version files in your projects:
# In your project directory
echo "1.21.0" > .gopher-version
# Auto-switch script
#!/bin/bash
if [[ -f .gopher-version ]]; then
version=$(cat .gopher-version)
if gopher list --json | jq -e ".[] | select(.version == \"go$version\")" > /dev/null; then
gopher use $version
else
echo "Installing Go $version..."
gopher install $version
gopher use $version
fi
fi
Gopher provides clear visual indicators to help you identify the active Go version and distinguish between different types of versions.
The list command shows clear visual indicators for the currently active version:
gopher list
Output with indicators:
go1.24.7 (darwin/arm64) [system]
go1.22.0 (darwin/arm64)
go1.22.1 (darwin/arm64)
→ go1.23.0 (darwin/arm64) [active]
Indicator meanings:
→ - Arrow pointing to the currently active version[active] - Text label indicating the active version[system] - Text label indicating system-installed GoGopher automatically detects terminal color support and provides:
If you prefer plain text output:
# Use JSON output for scripting
gopher --json list
# Or redirect to a file
gopher list > versions.txt
Gopher provides flexible verbosity control through command-line flags to help you get the right amount of information for your needs.
Gopher supports multiple log levels:
# Minimal output - only errors
gopher --quiet list
gopher -q install 1.21.0
# Useful for scripting and automation
current_version=$(gopher -q current --json | jq -r '.version')
# Detailed output with debugging information
gopher --verbose install 1.21.0
gopher -v list
# Shows detailed progress and internal operations
gopher -v install 1.21.0
# Output:
# [DEBUG] Starting Go installation {version=go1.21.0 file=/tmp/go1.21.0.darwin-arm64.tar.gz}
# [INFO] Downloading file {file=go1.21.0.darwin-arm64.tar.gz}
# [DEBUG] Extracting files {count=1000}
# [INFO] Successfully installed Go version {version=go1.21.0}
# Standard output - general information
gopher list
gopher install 1.21.0
# Shows important information without excessive detail
# Quiet installation (minimal output)
gopher -q install 1.21.0
# Verbose installation (detailed progress)
gopher -v install 1.21.0
# Default installation (standard progress)
gopher install 1.21.0
# Quiet listing (just the list)
gopher -q list
# Verbose listing (with metadata)
gopher -v list
# Default listing (standard format)
gopher list
# Quiet system info
gopher -q system
# Verbose system detection
gopher -v system
# Default system info
gopher system
Verbosity flags work with other command-line options:
# Verbose JSON output
gopher -v --json list
# Quiet installation with custom config
gopher -q --config /path/to/config.json install 1.21.0
# Verbose alias creation
gopher -v alias create stable 1.21.0
# Debug installation issues
gopher -v install 1.21.0
# Debug system detection
gopher -v system
# Debug alias operations
gopher -v alias create stable 1.21.0
# Quiet mode for scripts
gopher -q current --json
# Error-only output for error handling
gopher -q install 1.21.0 || echo "Installation failed"
# Standard output for interactive use
gopher list
gopher install 1.21.0
Use this decision tree to quickly identify and resolve common issues:
┌─────────────────────────────────────────────────────────────────┐
│ GOPHER TROUBLESHOOTING DECISION TREE │
└─────────────────────────────────────────────────────────────────┘
START: What's the problem?
│
├─ [Gopher command not found]
│ │
│ ├─ Check if installed: which gopher
│ │ ├─ Not found → Reinstall (see Installation section)
│ │ └─ Found → Check PATH configuration
│ │ └─ Add to PATH: export PATH=$PATH:/path/to/gopher
│ │
│ └─ Still not working?
│ └─ Check shell config (~/.bashrc or ~/.zshrc)
│ └─ Reload: source ~/.bashrc
│
├─ [Version not switching / Wrong version active]
│ │
│ ├─ Verify switch: gopher current
│ │ └─ Check actual: go version
│ │
│ ├─ Not matching?
│ │ ├─ Check symlink: ls -la $(which go)
│ │ ├─ Reload shell: source ~/.bashrc
│ │ └─ Try switching again: gopher use <version>
│ │
│ └─ Still wrong?
│ └─ Check for multiple Go installations
│ └─ which -a go # Shows all Go binaries in PATH
│
├─ [Installation failed / Download issues]
│ │
│ ├─ Check internet connection
│ │ └─ Test: curl -I https://go.dev/dl/
│ │
│ ├─ Try different mirror
│ │ └─ gopher env set mirror_url=https://golang.google.cn/dl/
│ │
│ ├─ Check disk space
│ │ └─ df -h ~/.gopher
│ │
│ └─ Enable verbose logging
│ └─ gopher --verbose install <version>
│
├─ [Permission denied errors]
│ │
│ ├─ Linux/macOS
│ │ ├─ Check permissions: ls -la ~/.gopher
│ │ ├─ Fix if needed: chmod -R u+w ~/.gopher
│ │ └─ May need sudo: sudo gopher use <version>
│ │
│ └─ Windows
│ ├─ Check Developer Mode: Settings → Privacy & Security
│ ├─ Enable Developer Mode (required for symlinks)
│ └─ Run as Administrator (if needed)
│
├─ [Go programs not finding packages]
│ │
│ ├─ Check GOPATH: echo $GOPATH
│ │ └─ Not set?
│ │ └─ gopher env show <version>
│ │ └─ Copy and run export commands
│ │
│ ├─ Check GOROOT: echo $GOROOT
│ │ └─ Should point to: ~/.gopher/versions/<version>
│ │
│ └─ Reset environment
│ └─ gopher env reset
│ └─ gopher use <version>
│
├─ [Installed Go tools/packages not working]
│ │
│ ├─ Check if GOPATH/bin is in PATH: echo $PATH | grep $GOPATH/bin
│ │ └─ Not found?
│ │ └─ Add to PATH (Gopher shows warning with instructions)
│ │ ├─ Unix: export PATH="$GOPATH/bin:$PATH"
│ │ └─ Windows: set PATH=%GOPATH%\bin;%PATH%
│ │
│ └─ Check GOPATH: echo $GOPATH
│ └─ Should match current version's GOPATH
│ └─ gopher env show <version>
│ └─ Verify PATH includes GOPATH/bin
│
├─ [Slow downloads]
│ │
│ ├─ Try different mirror
│ │ └─ China: gopher env set mirror_url=https://golang.google.cn/dl/
│ │
│ ├─ Check proxy settings
│ │ └─ echo $GOPROXY
│ │
│ └─ Use direct connection
│ └─ gopher env set goproxy=direct
│
└─ [Other issues]
│
├─ Enable debug logging
│ └─ gopher --verbose <command>
│
├─ Check system status
│ └─ gopher system
│
├─ Verify installation
│ └─ gopher list
│ └─ gopher current
│
└─ Still stuck?
├─ Check FAQ: docs/FAQ.md
├─ Search Issues: github.com/molmedoz/gopher/issues
└─ Create New Issue with debug output
Run these commands to gather diagnostic information:
# Check Gopher installation
which gopher
gopher version
# Check current Go setup
which go
go version
gopher current
gopher system
# Check environment
echo $PATH
echo $GOROOT
echo $GOPATH
gopher env list
# List all installed versions
gopher list
# Check for multiple Go installations
which -a go # Linux/macOS
where go # Windows
Problem:
Error: failed to create symlink: permission denied
Solution:
# On macOS/Linux, you may need sudo for system-wide symlinks
sudo gopher use 1.21.0
# Or use a local installation directory
export GOPHER_INSTALL_DIR=~/.local/go-versions
gopher use 1.21.0
Problem:
go: command not found
Solution:
# Check if symlink was created
ls -la /usr/local/bin/go
# Recreate symlink
gopher use 1.21.0
# Check PATH
echo $PATH
Problem:
System Go not showing in gopher list
Solution:
# Check if Go is in PATH
which go
# Check system detection
gopher system
# Verify Go installation
go version
Problem:
Error: failed to download version
Solution:
# Check internet connection
ping go.dev
# Try different mirror
gopher --config <(echo '{"mirror_url": "https://golang.org/dl/"}') install 1.21.0
# Check disk space
df -h
Enable verbose output for debugging:
# Set debug environment variable
export GOPHER_DEBUG=1
# Run commands with debug output
gopher list
gopher install 1.21.0
Gopher logs to:
~/.gopher/gopher.log%USERPROFILE%\gopher\gopher.logIf gopher gets into a bad state:
# Remove gopher directory
rm -rf ~/.gopher
# Reinstall
go install github.com/molmedoz/gopher/cmd/gopher@latest
# Reconfigure
gopher list
# Use different mirror
gopher --config <(echo '{"mirror_url": "https://golang.org/dl/"}') install 1.21.0
# Corporate mirror
gopher --config <(echo '{"mirror_url": "https://internal-mirror.company.com/go/"}') install 1.21.0
# Different configs for different projects
gopher --config ~/.gopher/project1.json use 1.21.0
gopher --config ~/.gopher/project2.json use 1.20.7
Add to VS Code settings:
{
"go.goroot": "~/.gopher/versions/go1.21.0",
"go.toolsEnvVars": {
"GOROOT": "~/.gopher/versions/go1.21.0"
}
}
# Use gopher in Docker
FROM golang:1.21-alpine AS gopher
RUN go install github.com/molmedoz/gopher/cmd/gopher@latest
FROM alpine:latest
COPY --from=gopher /go/bin/gopher /usr/local/bin/gopher
RUN gopher install 1.21.0
See CONTRIBUTING.md for information on contributing to Gopher.