News for hackers. Stuff that matters.
Re:Using Go Modules by fourseventy on Wednesday March 20, 2019 @12:59PM (#19444149)
The main thing that annoys me about Go modules is that it broke so much tooling. I still can't get GoCode to work properly, and there are 4 or 5 different forks of the repo all trying to add module support, its a mess.
Re:Using Go Modules by kyrra on Wednesday March 20, 2019 @01:27PM (#19444509)
The VSCode go plugin team has been doing a good job of staying on-top of this[0]. Which points to a golang bug[1] where the Go team is tracking tooling programs that need to be updated for Go Modules. So the Go team is aware of this issue and people are working to get all the major tools on board.

[0] https://github.com/Microsoft/vscode-go/wiki/Go-modules-suppo...

[1] https://github.com/golang/go/issues/24661

Re:Using Go Modules by weberc2 on Wednesday March 20, 2019 @03:09PM (#19445701)
This hasn't been my experience. VSCode still regularly fails to resolve dependencies for me. Usually it's because I added a go.mod after opening VSCode and I just need to restart the latter, but sometimes even that doesn't work. Hard to say exactly what the cause is since debugging VSCode is quite difficult (or maybe I'm just looking in the wrong places).
Re:Using Go Modules by farslan on Wednesday March 20, 2019 @03:14PM (#19445746)
This is now mostly fixed with "gopls". It's using go/packages under the hood which is both GOPATH and Go modules aware. gopls has also caching inbuilt, both code completion and jump to definition works very well.

If you're using vim-go, HEAD has now gopls support. I believe vscode also added recently support for gopls.

Other than, I agree that it broke all other tools, but most of them are migrated to use the go/packages package so it'll be better going forward.

Re:Using Go Modules by shabbyrobe on Wednesday March 20, 2019 @05:35PM (#19447201)
It's not really fixed though. When using vim-go with gopls, I see extortionate memory and CPU usage relative to what gocode used to use, and glacial lookup times compared to what gocode used to offer. Maybe it's perfectly adequate for you, and if so that's great! But that has not been my experience. Neither gopls nor any of the dozen forks of gocode I've tried since 1.11 has come close to the pre-modules experience for speed, accuracy and acceptable resource usage.

I tried to use the profiling flags to get some data to file reports, but ran out of yak-shaving time when I realised was trying to flush out a bug in the tool command helpers in golang/go where it would write empty profiles if the process was shut down the exact way vim was shutting it down. That may have been fixed since, I haven't had a chance to look back into it.

Re:Using Go Modules by LukeShu on Wednesday March 20, 2019 @02:37PM (#19445357)
There's a reason why Go 1.12 still doesn't set GO111MODULE=on by default. They're waiting until not so much tooling is broken on modules.
Re:Using Go Modules by throwaway8879 on Wednesday March 20, 2019 @01:12PM (#19444324)
Gocode works in vim but for some reason won't do autocomplete in spacemac's go-mode. I haven't found the time to look for a fix yet. There's a fork of Gocode that fixes it, but makes vim's autocomplete very very slow. As someone who switches between vim and emacs I wish this mess gets sorted out soon!
Re:Using Go Modules by farslan on Wednesday March 20, 2019 @03:11PM (#19445721)
HEAD of vim-go has now gopls support, which has excellent support for Go modules for code completion and jumpt to definition. Give it a try.
Re:Using Go Modules by throwaway8879 on Wednesday March 20, 2019 @09:03PM (#19448471)
Oh, I'm already using vim-go, but didn't know it does code completion too. Thanks for writing such a great plugin!
Re:Using Go Modules by pcnix on Wednesday March 20, 2019 @01:39PM (#19444670)
What's the fork that fixes the problem? I haven't used Go since modules released, but I'm going to be needing it soon, and this is something I need.
Re:Using Go Modules by throwaway8879 on Wednesday March 20, 2019 @09:02PM (#19448463)
Re:Using Go Modules by jrockway on Wednesday March 20, 2019 @01:16PM (#19444355)
I have been using https://github.com/stamblerre/gocode with company-mode in Emacs. It mostly works. (The limitation with gocode, it seems, is that your file has to be saved and the package you want to complete from has to be listed in the imports list in order for it to do anything. Not sure if that is what is broken with modules, or just how it is. I started using gocode after I started using modules.)
Re:Using Go Modules by buckhx on Wednesday March 20, 2019 @11:16PM (#19449023)
Preach, gorename doesn't work either and seems to be in a pretty uncertain state.

This issue is tracking compatibility of common tools https://github.com/golang/go/issues/24661

Re:Using Go Modules by techaul on Wednesday March 20, 2019 @01:06PM (#19444251)
Can't you just keep using GOPATH until they're fixed?
Re:Using Go Modules by ilovecaching on Wednesday March 20, 2019 @01:08PM (#19444270)
You can, go mod is completely opt in.
Re:Using Go Modules by ra7 on Wednesday March 20, 2019 @01:36PM (#19444620)
I think the language server implementation (x/tools/internal/lsp) should get rid of the need for Gocode. But I assume it's a while away.