**vscode go扩展插件异常,go代码可正常编译运行,但无法代码跳转及自动提示等辅助开发功能,请问如何解决,谢谢**
vscode 左下角状态栏提示"Setting up workspace: Loading packages..."
go extension插件runtime status提示Uncaught Errors (12),Message header must separate key and value using、Header must
provide a Content-Length property
一、环境
vscode版本1.75.0
go extension版本0.37.1
gopls版本0.11.0
setting中Go: Use Language Server已勾选
二、异常日志内容
2.1、gopls(server).log
[Trace - 16:15:21.778 PM] Received notification 'window/logMessage'.
Params: {"type":1,"message":"2023/02/07 16:15:21 errors loading workspace: packages.Load error: err: exit status 1: stderr: go tool compile: WaitForSingleObject: The handle is invalid.\n\n\tsnapshot=0\n\tdirectory=file:///C:/workspace/go/xxxxx\n"}
2.3、exthosts.log
2023-02-07 15:38:54.766 [info] ExtensionService#_doActivateExtension vscode.emmet, startup: false, activationEvent: 'onLanguage'
2023-02-07 15:38:54.840 [info] ExtensionService#_doActivateExtension vscode.github-authentication, startup: false, activationEvent: 'onAuthenticationRequest:github'
2023-02-07 15:38:54.925 [info] ExtensionService#_doActivateExtension vscode.git-base, startup: true, activationEvent: '*', root cause: vscode.git
2023-02-07 15:38:55.595 [info] ExtensionService#_doActivateExtension vscode.git, startup: true, activationEvent: '*'
2023-02-07 15:38:55.679 [info] ExtensionService#_doActivateExtension vscode.github, startup: true, activationEvent: '*'
2023-02-07 15:38:56.054 [info] ExtensionService#_doActivateExtension vscode.microsoft-authentication, startup: false, activationEvent: 'onAuthenticationRequest:microsoft'
2023-02-07 15:38:56.204 [info] ExtensionService#_doActivateExtension golang.go, startup: true, activationEvent: 'workspaceContains:*.go,*/*.go,*/*/*.go'
2023-02-07 15:39:02.486 [info] Eager extensions activated
2023-02-07 15:39:02.538 [info] ExtensionService#_doActivateExtension vscode.debug-auto-launch, startup: false, activationEvent: 'onStartupFinished'
2023-02-07 15:39:02.603 [info] ExtensionService#_doActivateExtension vscode.merge-conflict, startup: false, activationEvent: 'onStartupFinished'
2023-02-07 15:39:02.713 [info] ExtensionService#_doActivateExtension ms-vscode-remote.remote-wsl-recommender, startup: false, activationEvent: 'onStartupFinished'
2023-02-07 15:39:03.240 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:04.103 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:05.024 [error] Error: Header must provide a Content-Length property.
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3762:21)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:06.291 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:06.659 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:06.680 [error] Error: Header must provide a Content-Length property.
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3762:21)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:07.040 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:07.709 [error] Error: Header must provide a Content-Length property.
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3762:21)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:15.353 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:15.355 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:15.355 [error] Error: Header must provide a Content-Length property.
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3762:21)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:15.591 [error] Error: Message header must separate key and value using :
at MessageBuffer.tryReadHeaders (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:2553:19)
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3756:41)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
2023-02-07 15:39:16.267 [error] Error: Header must provide a Content-Length property.
at StreamMessageReader.onData (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3762:21)
at Socket.<anonymous> (c:\Users\xxxxx\.vscode\extensions\golang.go-0.37.1\dist\goMain.js:3746:16)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)
at Readable.push (node:internal/streams/readable:228:10)
at Pipe.onStreamRead (node:internal/stream_base_commons:190:23)
有疑问加站长微信联系(非本文作者)