Skip to content

一个简单的 Go 版本管理工具,专为 Windows 系统打造/A Simple Go Versioning Tool for Windows

License

Notifications You must be signed in to change notification settings

yuaotian/go-version-switch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-version-switch

Release Go Version Release Build License

🔄 A simple Go version management tool designed for Windows

简体中文 | English

✨ Features

  • 🔍 Real-time display of current Go version information
  • 📋 Manage multiple installed Go versions
  • ⬇️ Automatic download and installation of official releases
  • 🔄 Quick switching between different Go versions
  • ⚙️ Smart system environment variable management
  • 💾 Support for environment configuration backup and restore
  • 🔒 Secure environment variable rollback mechanism
  • 🌐 Multi-architecture support (x86/x64/arm/arm64)

🚀 Quick Start

📥 Installation

Method 1: Direct Download

Download the latest version from the Releases page.

Method 2: Build from Source

# Clone repository
git clone https://github.com/yuaotian/go-version-switch.git
cd go-version-switch

# Build
go build -o go-version-switch.exe ./cmd

# Add executable to PATH
# Recommended to copy the compiled file to C:\Program Files\go-version-switch\

🎯 Basic Usage

# View help information
go-version-switch -h

# Check current version
go-version-switch -version

# List all installed versions
go-version-switch -list

# List all versions before update version list
go-version-switch -list -update

# Install specific version
go-version-switch -install 1.19.5 

# Install specific version and architecture
go-version-switch -install 1.19.5 -arch x64

# Switch to specified version
go-version-switch -use 1.19.5

# Rollback environment variable configuration
go-version-switch -rollback

📁 Project Structure

go-version-switch/
├── 📂 cmd/
│   └── main.go                 # Program entry
├── 📂 internal/
│   ├── config/                # Configuration management
│   │   └── config.go         # Configuration handling
│   └── version/              # Version management
│       ├── common.go        # Common functions
│       ├── download.go      # Download functionality
│       ├── env.go          # Environment variable handling
│       ├── goversion.go    # Version information
│       ├── install.go      # Installation logic
│       ├── list.go        # Version listing
│       ├── releases.go    # Release management
│       └── version.go     # Version control
├── 📂 bin/
│   └── data/              # Runtime data
│       └── config/        # Configuration files
├── 📄 go.mod              # Dependency management
├── 📄 go.sum              # Dependency verification
└── 📝 README.md           # Project documentation

⚙️ System Requirements

  • Windows 10/11
  • Go 1.16+ (only for compilation)
  • Administrator privileges (for modifying environment variables)
  • Stable network connection (for downloading new versions)

🔧 Troubleshooting

Common Issues

  1. Insufficient Permissions

    Error: Administrator privileges required
    Solution: Run command prompt as administrator
  2. Download Failure

    Error: Download timeout
    Solution: Check network connection or use proxy
  3. Version Switch Failure

    Error: Environment variable update failed
    Solution: Use -rollback command to restore previous configuration

👨‍💻 Developer Guide

Building the Project

# Install dependencies
go mod download

# Run tests
go test ./...

# Build and test
go build -v -o bin/go-version-switch.exe ./cmd/main.go && ./bin/go-version-switch -install 1.23.4 -arch x86

Contributing

  1. Fork the project
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

📌 Important Notes

  1. 🔐 Administrator privileges required for modifying system environment variables
  2. 🔄 Terminal or IDE restart required after version switch
  3. 💾 Regular backup of environment variable configuration recommended
  4. ⚠️ Ensure stable network connection
  5. 📦 Do not manually modify the tool's data directory

🤝 Contribution Guidelines

  • Search for existing issues before submitting a new one
  • Provide detailed descriptions for Pull Requests
  • Follow project code standards
  • Ensure submitted code is tested

📄 License

This project is licensed under the MIT License.

About

一个简单的 Go 版本管理工具,专为 Windows 系统打造/A Simple Go Versioning Tool for Windows

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages