我尝试使用go语言设置visual studio代码进行开发 . 我通过lukehoban安装go扩展,并使用以下工具开发工具:github.com/alecthomas/gometalinter和github.com/derekparker/delve/cmd/dlv
ide不显示任何错误 . 当我运行以下代码时:
package main
import "fmt"
func main() {
fmt.Print("Enter a number: ")
var input float64
fmt.Scanf("%f\n", &input)
output := input * 2
fmt.Println(output)
}
我无法在步骤 fmt.Scanf("%f\n", &input)
输入任何数据
在调试控制台中显示“debugger.go:413:nexting”,但在输入任何数据进程后停止 .
当我运行没有断点的代码时,我得到:
TypeError:无法在GoDebugSession.evaluateRequest中读取null \ n的属性'currentGoroutine'(C:\ Users \ a.holikau.vscode \ extensions \ lukehoban.Go-0.6.44 \ out \ src \ debugAdapter \ goDebug.js:595 :45)\ n在GoDebugSession.DebugSession.dispatchRequest(C:\ Users \ a.holikau.vscode \ extensions \ lukehoban.Go-0.6.44 \ node_modules \ vscode-debugadapter \ lib \ debugSession.js:421:22)\在GoDebugSession.ProtocolServer._handleData(C:\ Users \ a.holikau.vscode \ extensions \ lukehoban.Go-0.6.44 \ node_modules \ vscode-debugadapter \ lib \ protocol.js:104:38)\ n在Socket上 . (C:\ Users \ a.holikau.vscode \ extensions \ lukehoban.Go-0.6.44 \ node_modules \ vscode-debugadapter \ lib \ protocol.js:24:60)\ n在emitOne(events.js:96:13) )\ n在Socket.emit(events.js:188:7)\ n在readableAddChunk(_stream_readable.js:176:18)\ n at Socket.Readable.push(_stream_readable.js:134:10)\ n at Pipe .onread(net.js:543:20)
任何想法如何解决它?
1 回答
根据您提供的堆栈跟踪,我将说这是Go扩展的问题 .
你应该检查扩展名official GitHub repository以查看问题是否已经报告,如果没有,你应该继续report it . 如果这确实是扩展的问题,他们应该能够解决它 .
如果事实证明这实际上是您配置扩展程序的方式的问题,那么他们应该能够为您提供有关修复扩展程序的更多信息 .
祝你好运!