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
ChronosMasterOfAllTime and others added 21 commits November 19, 2025 22:06
- 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.
@AdamDrewsTR
Copy link
Author

Version Architecture - Two Modes

GLOBAL Mode

 - Trigger: Using ~/.goenv/version (no local .go-version or go.mod)
 - Use case: General command-line work, not in a specific project
 - Resolution:
   - Version bin (~/.goenv/versions/1.25.4/bin/)
   - Version GOPATH (~/.goenv/versions/1.25.4/gopath/bin/)
   - Host bin (~/.goenv/hosts/darwin-arm64/gopath/bin/) ← Shared tools
 - When: Working in home directory, doing one-off commands, etc.

LOCAL Mode

 - Trigger: .go-version or go.mod in current directory or parent
 - Use case: Working on a specific project
 - Resolution:
   - Version bin (~/.goenv/versions/1.23.2/bin/)
   - Version GOPATH (~/.goenv/versions/1.23.2/gopath/bin/)
   - Host bin NOT checked ← Project isolation!
 - When: Inside any project directory with version file

Version Directory Sharing

Multiple projects using the same version share the same Go installation:

 Project A (.go-version: 1.23.2) ──┐
                                    ├──> ~/.goenv/versions/1.23.2/
 Project B (.go-version: 1.23.2) ──┘
 
 Same Go binary:      ~/.goenv/versions/1.23.2/bin/go
 Same version GOPATH: ~/.goenv/versions/1.23.2/gopath/bin/

This means:

 - ✅ Efficient: One Go installation per version, not per project
 - ✅ Shared tools: If you go install a tool in project A with 1.23.2, project B (also using 1.23.2) will see it
 - ✅ Version isolation: Projects using different versions (1.23.2 vs 1.24.0) have completely separate tool sets
 - ⚠️ Module cache: Shared via ~/.goenv/shared/go-mod (intentional, modules are version-agnostic source code)

The Consistency Rule

Everywhere in goenv now follows this standard:

 - exec: Uses resolver with version source ✅
 - which: Uses resolver with version source ✅  
 - shims: Will execute using the same resolution ✅
 - whence: Shows versions that have the tool (version-specific only) ✅

The ONLY exception is:

 - Host bin tools are ONLY accessible in GLOBAL mode

This gives you:

 - Predictable isolation when working on projects
 - Convenient sharing of global tools
 - Efficient storage (one Go installation per version)
 - Safe compatibility (tools match the Go version you're using)

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