Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't get any suggestions at any time,just like the plugin doesn't work. #474

Closed
zkip opened this issue Sep 16, 2017 · 6 comments
Closed

Comments

@zkip
Copy link

zkip commented Sep 16, 2017

main.go:

package main

import (
	"fmt"
)

func main() {
	fmt.
}

gocode -f=json --in=main.go autocomplete 52

[]

@nsf
Copy link
Owner

nsf commented Sep 16, 2017

That's weird, it should work. Probably it can't find your GOROOT and GOPATH. Try running gocode in a separate terminal window: gocode close && gocode -s -debug. Then in another window try doing autocompletion and see what it prints.

@zkip
Copy link
Author

zkip commented Sep 16, 2017

As you indicate, the console outputs this information:

*:***>gocode -s -debug
2017/09/17 04:30:34 Go project path: .
2017/09/17 04:30:34 Got autocompletion request for 'D:\warplace\main.go'
2017/09/17 04:30:34 Cursor at: 52
2017/09/17 04:30:34 -------------------------------------------------------
package main

import (
"fmt"
)

func main() {
fmt.#
}
2017/09/17 04:30:34 -------------------------------------------------------
2017/09/17 04:30:34 Import path "fmt" was not resolved
2017/09/17 04:30:34 Gocode's build context is:
2017/09/17 04:30:34 GOROOT: c:\go
2017/09/17 04:30:34 GOPATH: D:\lib\go
2017/09/17 04:30:34 GOOS: windows
2017/09/17 04:30:34 GOARCH: amd64
2017/09/17 04:30:34 BzlProjectRoot: ""
2017/09/17 04:30:34 GBProjectRoot: ""
2017/09/17 04:30:34 lib-path: ""
2017/09/17 04:30:34 Error parsing input file (inner block):
2017/09/17 04:30:34 4:6: expected selector or type assertion, found ';'
2017/09/17 04:30:34 extracted expression tokens: fmt
2017/09/17 04:30:34 Import path "fmt" was not resolved
2017/09/17 04:30:34 Gocode's build context is:
2017/09/17 04:30:34 GOROOT: c:\go
2017/09/17 04:30:34 GOPATH: D:\lib\go
2017/09/17 04:30:34 GOOS: windows
2017/09/17 04:30:34 GOARCH: amd64
2017/09/17 04:30:34 BzlProjectRoot: ""
2017/09/17 04:30:34 GBProjectRoot: ""
2017/09/17 04:30:34 lib-path: ""
2017/09/17 04:30:34 Offset: 0
2017/09/17 04:30:34 Number of candidates found: 0
2017/09/17 04:30:34 Candidates are:
2017/09/17 04:30:34 =======================================================

@nsf
Copy link
Owner

nsf commented Sep 16, 2017

Well, see what it prints for GOROOT, obviously "fmt" package wasn't resolved and it says that GOROOT is "C:\go". Does that match your Go installation? If you build Go from source code it will set a magic constant GOROOT default to whatever place it was compiled in. If you move the Go compiler suite later to a different location, there will be problems with that kind of approach. As for gocode, it will pass to server whatever environment variables client gets when doing an autocompletion request. Server will use those.

@zkip
Copy link
Author

zkip commented Sep 16, 2017

Alright,but how i config this?like GOROOT or other.

@nsf
Copy link
Owner

nsf commented Sep 16, 2017

Environment variables.

@zkip
Copy link
Author

zkip commented Sep 16, 2017

Oh,It's great that you solved my problem.
As you indicated, I added the environment variable, and then I can use it.
Thank you very much.

@nsf nsf closed this as completed Dec 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants