doujiang1832 2017-04-10 13:05
浏览 79

无法使Gocode正常工作

Hi I was try trying play around with gocode tool but since it has poor documentation I cannot figure out how it works. I've read

https://github.com/nsf/gocode/blob/master/docs/IDE_integration.md

I created a simple test file (path is d:\papa\papa.go):

package main

import (
    "fmt"
)
func main() {
    fmt.
}

It seems obvious that I want to get compilation for the fmt. part (to see functions and everything else exported from that package. Now I run

gocode -s -debug

And than

gocode -in=d:/papa/main.go -f=nice autocomplete 51

Here is gocode's output:

Found 2 candidates:
  func main()
  package fmt

It is not what I'd expect as you can see.

In the debug output I seen something interesting:

2017/04/10 15:58:15 Go project path: .

2017/04/10 15:58:15 Got autocompletion request for 'd:/papa/main.go'

2017/04/10 15:58:15 Cursor at: 51

2017/04/10 15:58:15


package main

import (

    "fmt"

)

# func main() {

    fmt.

}


2017/04/10 15:58:15 Found "fmt" at "D:\Go\pkg\windows_386\fmt.a"

2017/04/10 15:58:15 Error parsing input file (inner block):

2017/04/10 15:58:15 4:1: expected selector or type assertion, found '}'

2017/04/10 15:58:15 4:2: expected ';', found 'EOF'

2017/04/10 15:58:15 4:2: expected '}', found 'EOF'

2017/04/10 15:58:15 Offset: 0

2017/04/10 15:58:15 Number of candidates found: 2

2017/04/10 15:58:15 Candidates are:

2017/04/10 15:58:15 func main()

2017/04/10 15:58:15 package fmt

Needless to say there is no actual error during go build on this code.

So

  1. Why gocode doesn't provide with the relevant info?

  2. What is the deal about those "errors")?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 怎么用dlib库的算法识别小麦病虫害
    • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
    • ¥15 java写代码遇到问题,求帮助
    • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
    • ¥15 有了解d3和topogram.js库的吗?有偿请教
    • ¥100 任意维数的K均值聚类
    • ¥15 stamps做sbas-insar,时序沉降图怎么画
    • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
    • ¥15 关于#Java#的问题,如何解决?
    • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算