gocode icon indicating copy to clipboard operation
gocode copied to clipboard

How to config gocode in multiple bazel projects

Open junghoahnsc opened this issue 7 years ago • 4 comments

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,

junghoahnsc avatar Mar 30 '17 18:03 junghoahnsc

"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

nsf avatar Mar 30 '17 19:03 nsf

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.

dmitshur avatar Mar 30 '17 19:03 dmitshur

@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.

linuxerwang avatar Apr 01 '17 14:04 linuxerwang

@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!

junghoahnsc avatar Apr 01 '17 19:04 junghoahnsc