Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Go runtime path detection failed on MSYS2 #983

Closed
ipsusila opened this issue May 9, 2017 · 2 comments
Closed

Go runtime path detection failed on MSYS2 #983

ipsusila opened this issue May 9, 2017 · 2 comments

Comments

@ipsusila
Copy link

ipsusila commented May 9, 2017

On MSYS2, Go binary is not located under ${GOROOT}/bin thus getGoRuntimePath() in goPath.ts failed to locate go.exe. Example go env output in MSYS2:

GOROOT=<installation directory>\mingw64\lib\go
GOTOOLDIR=<installation directory>\mingw64\lib\go\pkg\tool\windows_amd64

//Go binary at (accessible through ${PATH})
<installation directory>\mingw64\bin

where <installation directory> is the directory where I installed MSYS2. Currently I fix this issue by changing goPath.ts line 79-84

if (process.env['GOROOT']) {
    runtimePathCache = path.join(process.env['GOROOT'], 'bin', correctBinNameGo);
} else if (process.env['PATH']) {
    let pathparts = (<string>process.env.PATH).split(path.delimiter);
    runtimePathCache = pathparts.map(dir => path.join(dir, correctBinNameGo)).filter(candidate => fileExists(candidate))[0];
}

to

if (process.env['GOROOT']) {
    runtimePathCache = path.join(process.env['GOROOT'], 'bin', correctBinNameGo);
    if (!fileExists(runtimePathCache))
        runtimePathCache = null;
} 
if (!runtimePathCache && process.env['PATH']) {
    let pathparts = (<string>process.env.PATH).split(path.delimiter);
    runtimePathCache = pathparts.map(dir => path.join(dir, correctBinNameGo)).filter(candidate => fileExists(candidate))[0];
}
@ramya-rao-a
Copy link
Contributor

Thanks for reporting @ipsusila !

I have committed the fix (67557af) and it will be out in the next update

@ramya-rao-a
Copy link
Contributor

The fix is now available in the latest update (0.6.62)

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 24, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants