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

cant find definition #84

Closed
Kurt-Shiwz opened this issue Aug 4, 2018 · 3 comments
Closed

cant find definition #84

Kurt-Shiwz opened this issue Aug 4, 2018 · 3 comments

Comments

@Kurt-Shiwz
Copy link

if import some lib like ". github.com/a/b", can't goto definition which define in b.
function is also undefined.

// b.go
type GlobalConfig struct {
	Localaddr string
}
func InitGlobalVars(globalconfig *GlobalConfig) error {
}


// main.go
import (
. github.com/a/b
)
// can't goto definition
globalconfig := &GlobalConfig{}
// InitGlobalVars is undefined
InitGlobalVars(globalconfig)
@boxu-zhang
Copy link

I've encountered such problem recently. And got it solved with two steps: 1, please make sure GOPATH & GOROOT environment variable are set properly. Some config might affect the variables value actually take effects, like 'go.gopath' setting of Vscode. 2, please make sure all of your source code are encoded without some BOM(UTF-8 BOM) or something like.

Then it should work. @Kurt-Shiwz

@rogpeppe
Copy link
Owner

rogpeppe commented Aug 9, 2018

This is issue #19. The current answer is, I'm afraid: don't use dot-imports. They're never necessary.

@Kurt-Shiwz
Copy link
Author

"Known limitations:

  • it does not understand about "." imports
  • it does not deal well with definitions in tests."
    README write that.
    @boxu-zhang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants