vscode运行go代码时,出现输出乱码

img


vscode运行go代码时,出现输出乱码,请教各位强者求解决方案

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 你可以看下这个问题的回答https://ask.csdn.net/questions/7653616
  • 除此之外, 这篇博客: vscode安装go插件填坑中的 二、解决办法 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:

    找了一篇能解决大部分问题的博客:

    Windows64 Visual Studio Code 安装go插件失败分析及解决方案

    但是在最后的操作时,还是有一些报错的

    E:\GOPATH>go install github.com/sqs/goreturns
    src\golang.org\x\tools\internal\imports\mod.go:17:2: cannot find package "golang.org/x/mod/module" in any of:
            E:\Go\src\golang.org\x\mod\module (from $GOROOT)
            E:\GOPATH\src\golang.org\x\mod\module (from $GOPATH)
    src\golang.org\x\tools\internal\imports\mod.go:18:2: cannot find package "golang.org/x/mod/semver" in any of:
            E:\Go\src\golang.org\x\mod\semver (from $GOROOT)
            E:\GOPATH\src\golang.org\x\mod\semver (from $GOPATH)
    
    E:\GOPATH>go install github.com/sqs/goreturns
    src\golang.org\x\mod\module\module.go:106:2: cannot find package "golang.org/x/xerrors" in any of:
            E:\Go\src\golang.org\x\xerrors (from $GOROOT)
            E:\GOPATH\src\golang.org\x\xerrors (from $GOPATH)
    

    出错的原因在另一篇博客中找到了:
    一键解决 go get golang.org/x 包失败
    就是因为缺失依赖的包,直接用git clone对应的包就行


如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^