nsf / gocode

An autocompletion daemon for the Go programming language
MIT License
5.01k stars 657 forks source link

How to config gocode in multiple bazel projects #442

Open junghoahnsc opened 7 years ago

junghoahnsc commented 7 years ago

Hello,

I'm trying to use gocode with YouCompleteMe in my multiple bazel projects. For this, it looks like I have to set package-lookup-mode to bzl and set lib-path. What is the best practice when there are multiple bazel projects?

Thanks,

nsf commented 7 years ago

"bzl" stuff wasn't written by me, have no idea, maybe someone else will answer. The guy who wrote it doesn't have a github account anymore it seems: https://github.com/nsf/gocode/commit/725b543fef1c612e2885f9a3ad83c5fca52fd97a

dmitshur commented 7 years ago

The guy who wrote it doesn't have a github account anymore it seems: 725b543

He does, it's @linuxerwang. It's just the email he used to author that git commit isn't linked to his github account. See #364. He also said in https://github.com/nsf/gocode/pull/364#issuecomment-234965848:

Sure, I'll maintain it.

linuxerwang commented 7 years ago

@junghoahnsc What do you mean multiple bazel projects? Are these projects completely separated workspaces? Bazel originates from Google's monolithic code management which is good at managing all projects in one code repo. So it's typical to organize all your code into one workspace.

If you do have multiple workspaces, then it's not convenient to use gocode, just like if you have multiple GOPATH directories and you want each of them be separated from others. At any given time you are only able to work on one workspace. Yes, you have to change the gocode configuration.

If you stick to monolithic workspace, there is a better solution to make rules_go work with all Golang tools: https://github.com/linuxerwang/gobazel, without touching gocode.

junghoahnsc commented 7 years ago

@linuxerwang Yes, we have to handle multiple git repo (workspaces), which is not in my control. If gocode can read the config file from each repo (workspace) root, I think it would be much convenient to handle this kind of cases. I'm also looking gobazel which seems to be very useful. But it would be great if it can support multiple configuration. Thanks!