doulilou8560 2018-04-25 20:47
浏览 739

Gorename不起作用:“重命名失败:gorename:找不到包含的软件包”

When trying to change the symbols, VSCode throws the following error:

"Rename failed: gorename: can't find package containing /home/hume/projects/go/main.go"

vscode 1.22.2 x64

go version go1.10.1 linux/amd64

go env GOPATH /home/hume/projects/go

My settings.json is as follows:

{
      "go.toolsGopath": "/home/hume/gotools"
    , "go.autocompleteUnimportedPackages": true
    , "go.inferGopath": true
    , "go.formatTool": "gofmt"
    , "go.vetFlags": [
        "/src"
       ]
}

Thanks.

  • 写回答

1条回答 默认 最新

  • ds2010630 2019-09-12 13:20
    关注

    VSCode uses gorename command-line tool to do rename. The tool supposes you are following the right package structure but it fails to find it. Create a src directory in %GOPATH%, i.e. create directory /home/hume/projects/go/src. Create another directory in src as the package directory and put main.go in the package directory. You need to add package declaration at main.go. Then the problem is resoved.

    评论

报告相同问题?

悬赏问题

  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常