Skip to content

Commit 63bd917

Browse files
authored
Fixed go lang install issue (#279)
Removed the old go version
1 parent c6a532c commit 63bd917

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/lsp.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
import log from 'electron-log'
2929
import Store from 'electron-store'
3030
import fixPath from 'fix-path'
31+
import { fileSystem } from './fileSystem'
3132

3233
const writeFilePromise = promisify(fs.writeFile)
3334
const lspDir = app.isPackaged
@@ -360,6 +361,10 @@ class LSPManager {
360361
case 'go':
361362
const goDir = path.join(lspDir, 'go')
362363
try {
364+
// Check $GOPATH, and remove $GOPATH/go.mod file
365+
const goPath = cp.execSync('echo $GOPATH').toString().trim()
366+
fs.accessSync(`${goPath}go.mod`, fs.constants.F_OK)
367+
await fileSystem.unlinkSync(`${goPath}/go.mod`)
363368
await promisify(cp.exec)(
364369
'go install golang.org/x/tools/gopls@latest',
365370
{

0 commit comments

Comments
 (0)