Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Go command hangs indefinitely

Tags:

go

When running go run ..., go get ..., etc., the process hangs and never returns. If I add the -x option, I only see the build stage and nothing more.

Since the last update to go, I've used it a bit and it worked fine. After a system restart, it suddenly stopped working.

like image 408
CantrianBear Avatar asked May 04 '16 16:05

CantrianBear


2 Answers

It took me a bit to figure out what was going on and I thought I share the problem solution here, in case somebody else encounters the problem.

As it appears in most cases, if GOPATH is set wrong, you'll likely get some kind of error message and the process ends. My problem was that GOPATH was set to a folder that should have been mounted at boot up. Not only was the path incorrect, but also the mounting of the drive failed. And exactly that was the problem. For some reason, when GOPATH points to an unmounted drive, you won't see an error message and the process hangs forever.

like image 64
CantrianBear Avatar answered Sep 29 '22 09:09

CantrianBear


A solution that worked for me : If you are working with Visual Studio Code, remove the import section and press Ctrl+S, and let the imported files list get regenerated.

like image 32
Amir Leshem Avatar answered Sep 29 '22 09:09

Amir Leshem