Skip to content

Conversation

@AdamDrewsTR
Copy link

@AdamDrewsTR AdamDrewsTR commented Oct 11, 2025

Solves #480

@ChronosMasterOfAllTime ChronosMasterOfAllTime changed the base branch from master to v3 October 12, 2025 14:03
  feat: Add version usage analysis and major UX enhancements

     This massive update adds 7 new commands, enhances diagnostics, improves tool
     management, and introduces version usage scanning to help users manage their
     Go installations more effectively.

     🎉 7 New Commands
     1. goenv info - Detailed version information with lifecycle tracking
     2. goenv compare - Side-by-side version comparison
     3. goenv status - Quick installation health check
     4. goenv setup - Automatic first-time configuration wizard
     5. goenv get-started - Interactive beginner's guide
     6. goenv explore - Command discovery by intent/category
     7. goenv versions --used - Scan projects for version usage (🆕)

     🔥 Doctor Improvements
     - Interactive fix mode (--fix) - automatically repair issues
     - 3 new diagnostic checks (shell environment, profile sourcing, duplicate
   installations)
     - 18 structured issue types with automated fixes
     - Better UX (colors, emojis, clearer messages)
     - Detects "undo sourcing" scenarios (major pain point)

     🔍 Version Usage Analysis (New!)
     - goenv versions --used - Scan current directory tree for version usage
     - Shows which versions are used by projects (.go-version, go.mod)
     - Helps identify versions safe to remove
     - Depth control with --depth flag (default: 3 levels)
     - Fast performance (<1s for typical project trees)
     - Smart directory skipping (node_modules, .git, vendor, etc.)

     📦 Tool Management Enhancements
     - New commands: install, uninstall, list, status, outdated
     - --all flag to operate across all Go versions
     - Better tool consistency checking
     - Improved sync capabilities

     📦 +6 Internal Packages
     - internal/lifecycle - Go version EOL tracking (1.12-1.25)
     - internal/shellutil - Enhanced shell detection & management
     - internal/utils/prompt.go - Interactive prompting system
     - internal/utils/firstrun.go - First-run detection utilities
     - internal/utils/output.go - Consistent output formatting
     - internal/manager/scan.go - Project scanning for version analysis
…consolidation.

- Added InteractiveSetup and AutoInstallSetup structs to handle user interactions and automatic installations.
- Implemented version discovery from .go-version and go.mod files.
- Added prompts for installation and VS Code settings updates.
- Introduced WorkflowResult and AutoInstallResult types to encapsulate outcomes of the workflows.
- Enhanced error handling and user feedback throughout the setup processes.

refactor: Improve command execution in build-tool script

- Replaced direct exec.Command calls with utility functions for better error handling and context management.
- Updated platform checks to use the new platform package for OS detection.
- Streamlined directory creation and permission setting with utility functions.

fix: Optimize embedded version generation script

- Refactored fetchReleases function to use a utility for fetching JSON with timeout.
- Improved file size reporting after generating embedded versions.

chore: Enhance swap script with platform-specific checks

- Updated OS checks to utilize the platform package for better readability.
- Refactored file existence checks and command executions to use utility functions.

test: Add test utilities for easier test file handling

- Introduced WriteTestFile and StripDeprecationWarning functions to simplify test setup and output processing.
@ChronosMasterOfAllTime ChronosMasterOfAllTime changed the title WIP: V3 - Go go goenv WIP: V3 - Initial Cut of Modernized Go version Nov 3, 2025
…on support

**Install command auto-detection:**
- Detects version from .go-version in current directory or parents
- Falls back to go.mod directive when no .go-version exists
- Uses latest stable as final fallback
- Explicit version arguments override auto-detection
- Quiet mode suppresses all detection messages

**Partial version resolution:**
- `goenv install 1.21` resolves to latest 1.21.x (e.g., 1.21.13)
- `goenv uninstall 1.22` intelligently handles multiple matches
- Proper prefix matching prevents false matches (1.2 ≠ 1.21)

**Uninstall improvements:**
- Interactive selection when multiple versions match
- `--all` flag to uninstall all matching versions
- Non-interactive mode picks latest automatically
- Smart version resolution with user feedback

**Enhanced documentation:**
- Updated COMMANDS.md with install auto-detection examples
- Added troubleshooting and best practices
- CI/CD integration examples
- Security checksum verification guidance

**Doctor command enhancements:**
- Detects obsolete v3 environment variables (GOENV_PREPEND_GOPATH, etc.)
- Checks for unnecessary PATH entries in Homebrew installations
- Warns about stale configuration that could cause issues

**Comprehensive test coverage:**
- Auto-detection scenarios (7 test cases)
- Partial version resolution (6 test cases)
- Interactive vs non-interactive behavior
- Multi-version uninstall workflows
- Help text validation
- Edge case prefix matching

- Old `goenv install` behavior unchanged when explicit version provided
- New auto-detection only activates when no version argument given
- Uninstall now supports partial versions (previously required exact match)
- Introduced `goenv vscode setup` command for comprehensive setup, combining initialization, syncing, and validation.
- Improved user experience by checking for Go extension settings and preventing PATH injection.
- Added interactive prompts for auto-detecting VS Code workspace and configuring settings.
- Implemented `goenv.autoSync` feature to automatically update VS Code settings when changing Go versions.
- Updated documentation to reflect new commands and troubleshooting steps for common issues.
- Added new troubleshooting guide for VS Code integration, addressing common problems and solutions.
- Enhanced error handling and user feedback during configuration processes.
- Introduced new internal functions for managing VS Code user settings and checking Go extension configuration.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants