@@ -176,6 +176,7 @@ func runDoctor(cmd *cobra.Command, args []string) error {
176176 ctx := cmdutil .GetContexts (cmd )
177177 cfg := ctx .Config
178178 mgr := ctx .Manager
179+ env := ctx .Environment
179180 results := []checkResult {}
180181
181182 // Validate and parse --fail-on flag
@@ -240,13 +241,13 @@ func runDoctor(cmd *cobra.Command, args []string) error {
240241 results = append (results , checkNetwork ())
241242
242243 // Check 11: VS Code integration
243- results = append (results , checkVSCodeIntegration (cfg ))
244+ results = append (results , checkVSCodeIntegration (cfg , env ))
244245
245246 // Check 11b: VS Code Go extension PATH injection
246247 results = append (results , checkVSCodeGoExtension ())
247248
248249 // Check 12: go.mod version compatibility
249- results = append (results , checkGoModVersion (cfg ))
250+ results = append (results , checkGoModVersion (cfg , env ))
250251
251252 // Check 13: Verify 'which go' matches expected version
252253 results = append (results , checkWhichGo (cfg , mgr ))
@@ -273,7 +274,7 @@ func runDoctor(cmd *cobra.Command, args []string) error {
273274 results = append (results , checkCacheIsolationEffectiveness (cfg , mgr ))
274275
275276 // Check 19: Rosetta detection (macOS only)
276- results = append (results , checkRosetta (cfg ))
277+ results = append (results , checkRosetta (cfg , env ))
277278
278279 // Check 20: PATH order (goenv shims before system Go)
279280 results = append (results , checkPathOrder (cfg ))
@@ -1740,7 +1741,8 @@ func detectFixableIssues(results []checkResult, cfg *config.Config) []fixableIss
17401741// Fix helper functions
17411742
17421743func fixRehash (cmd * cobra.Command , cfg * config.Config ) error {
1743- shimMgr := shims .NewShimManager (cfg )
1744+ ctx := cmdutil .GetContexts (cmd )
1745+ shimMgr := shims .NewShimManager (cfg , ctx .Environment )
17441746 return shimMgr .Rehash ()
17451747}
17461748
@@ -1809,7 +1811,8 @@ func fixReinstallCorrupted(cmd *cobra.Command, cfg *config.Config, version strin
18091811}
18101812
18111813func fixSetVersion (cmd * cobra.Command , cfg * config.Config ) error {
1812- mgr := manager .NewManager (cfg )
1814+ ctx := cmdutil .GetContexts (cmd )
1815+ mgr := manager .NewManager (cfg , ctx .Environment )
18131816 versions , err := mgr .ListInstalledVersions ()
18141817 if err != nil || len (versions ) == 0 {
18151818 return fmt .Errorf ("no versions installed" )
@@ -1824,7 +1827,8 @@ func fixInstallLatest(cmd *cobra.Command, cfg *config.Config) error {
18241827}
18251828
18261829func fixGoModVersion (cmd * cobra.Command , cfg * config.Config , version string ) error {
1827- mgr := manager .NewManager (cfg )
1830+ ctx := cmdutil .GetContexts (cmd )
1831+ mgr := manager .NewManager (cfg , ctx .Environment )
18281832 if mgr .IsVersionInstalled (version ) {
18291833 fmt .Fprintf (cmd .OutOrStdout (), " Run: goenv local %s\n " , version )
18301834 } else {
@@ -2693,7 +2697,7 @@ func checkNetwork() checkResult {
26932697 }
26942698}
26952699
2696- func checkVSCodeIntegration (cfg * config.Config ) checkResult {
2700+ func checkVSCodeIntegration (cfg * config.Config , env * utils. GoenvEnvironment ) checkResult {
26972701 // Get current working directory
26982702 cwd , err := os .Getwd ()
26992703 if err != nil {
@@ -2734,7 +2738,7 @@ func checkVSCodeIntegration(cfg *config.Config) checkResult {
27342738 }
27352739
27362740 // Get current Go version to validate against
2737- mgr := manager .NewManager (cfg )
2741+ mgr := manager .NewManager (cfg , env )
27382742 currentVersion , _ , _ , err := mgr .GetCurrentVersionResolved ()
27392743 if err != nil || currentVersion == "" {
27402744 // Can't determine current version - do basic check
@@ -2861,7 +2865,7 @@ func checkVSCodeGoExtension() checkResult {
28612865 }
28622866}
28632867
2864- func checkGoModVersion (cfg * config.Config ) checkResult {
2868+ func checkGoModVersion (cfg * config.Config , env * utils. GoenvEnvironment ) checkResult {
28652869 cwd , _ := os .Getwd ()
28662870 gomodPath := filepath .Join (cwd , config .GoModFileName )
28672871
@@ -2876,7 +2880,7 @@ func checkGoModVersion(cfg *config.Config) checkResult {
28762880 }
28772881
28782882 // Get current Go version (resolved, e.g., "1.25" → "1.25.4")
2879- mgr := manager .NewManager (cfg )
2883+ mgr := manager .NewManager (cfg , env )
28802884 currentVersion , _ , _ , err := mgr .GetCurrentVersionResolved ()
28812885 if err != nil {
28822886 return checkResult {
@@ -3540,7 +3544,7 @@ func checkCacheIsolationEffectiveness(cfg *config.Config, mgr *manager.Manager)
35403544 }
35413545}
35423546
3543- func checkRosetta (cfg * config.Config ) checkResult {
3547+ func checkRosetta (cfg * config.Config , env * utils. GoenvEnvironment ) checkResult {
35443548 // Only relevant on macOS
35453549 if ! platform .IsMacOS () {
35463550 return checkResult {
@@ -3614,7 +3618,7 @@ func checkRosetta(cfg *config.Config) checkResult {
36143618 }
36153619
36163620 // Check current Go version architecture
3617- mgr := manager .NewManager (cfg )
3621+ mgr := manager .NewManager (cfg , env )
36183622 // Get resolved version (e.g., "1.25" → "1.25.4")
36193623 currentVersion , _ , _ , err := mgr .GetCurrentVersionResolved ()
36203624 if err != nil || currentVersion == "" || currentVersion == manager .SystemVersion {
0 commit comments