go - gorename failing in VS Code without explicit error
问题描述
In VSCode, I am trying to rename a variable using F2. This seems to run the gorename tool, but fails every time without explicit error. It simply displays:
/home/oops/dev/mtg-tracker/mtg-tracker-server/handlers>Finished running tool: /home/oops/dev/go/bin/golint
/home/oops/dev/mtg-tracker/mtg-tracker-server/handlers>Finished running tool: /usr/local/go/bin/go build -i -o /tmp/vscode-goVw9yJs/go-code-check .
/home/oops/dev/mtg-tracker/mtg-tracker-server/handlers>Finished running tool: /usr/local/go/bin/go vet ./...
Rename failed
I've looked into similar issues and it seems to normally come with an error such as an invalid GOROOT or incorrect package naming, but I see no such error here and I haven't been able to find any further info.
I also saw that someone fixed this by updating gorename, which I tried looking into but have not been able to figure out how to do.
Expected result: VSCode actually renames my variable.
Actual result: The rename fails and it stays the same.
解决方案
请注意,有一个issue 24661专门用于跟踪工具及其更新,用于命令行或 VSCode 使用。
该问题仅包括:
gorename
将不再支持,因为gopls
已经实现了重命名功能。
请参阅issue 27571,它指的是issue 32875。
同时,等待对 的完全支持gorename
,我正在使用saibing/tools
它确实产生了一个“扩展”版本gopls
,具有重命名支持。
这在 VSCode 中运行良好。
2019 年第四季度(11 月)更新:问题 32875现已关闭,gopls 已发布 0.2.0,应该修复这些错误。
完整的重命名支持仍然存在:CL 194878
保留 CL 207579:此更改添加了对prepare_rename
.
2020 年 9 月更新:
推荐阅读
- jquery - Ajax 请求后选择选项未重置
- matlab - Matlab if else循环
- php - 使用 Wordpress 为 ShareTribe 的托管版本创建页面
- android - 在 Kivy 中绑定 'esc' 并在 kv 文件中完成屏幕管理
- javascript - 在创建诸如仓位之类的递增值时如何消除可变性?
- haskell - Reddit API 收到评论
- python-3.x - 文本分隔符在数据框中移动值
- javascript - 通过单击按钮重置使用 css 创建的动画
- python-3.x - 在python中使用数据框避免for循环
- java - Maven CycleException