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
Why gocode doesn't provide with the relevant info?
What is the deal about those "errors")?