I am running go on ubuntu, it seemed it is installed.
go version go1.12 linux/amd64
I added the following to .bashrc file
export GOPATH = $HOME/go
export also PATH=$PATH:/usr/local/go/bin
I create a hello.go inside $HOME/go/hello
When I run go build I got an error says"failed to initialize build cache …", I tried it with sudo I got " sudo go not found"
Any suggestion to solve this?
Something goes wrong in your Go environment (even if the settings seems to be good ). I suggest you to use this project to properly install and the things will work. Delete any of your previous installation and configurations before.
Move it to
Package sourcecode lives in
Yes it is inside the src. Thanks
So its working after moving it?
Or do you still get an error?
If so, what is the exact error and how are you trying to compile the code, aka what is the exact command you invoke to compile?
Do not use
sudo unless you know what you are doing.
sudo is not the answer to permission problems, but
I have no clue how you ended up with illgormed permissions there, but removing the build cache should fix your issue. You cannot see the path to it in the error. You’ll probably need
sudo rm though, alternatively you should be able to
chown -r youruser:yourmaingroup path/to/buildcache.
I could execute a hello world go, your command was really helpful! Thank you :).
Now I have another issue as I am setting up a development environment
I run makefile, and got an error “/bin/sh go not found”?
it is again a permission issue if I use sudo before make, I got " go not found message"
You have done something really strange by randomly using
sudo as it seems.
You need to repair ownership and permissions again.
What is the easiest way to fix the permission?
Identifiying files that you can’t read or write to while you should, and then change permissions.
Thats the most correct way.
Quick and dirty hack is to
chown -r youruser:yourgroup ~. But this might change groupownership that you actually do not want to change. It probably won’t matter if you do not understand what I’m saying, then again I’d strictly advice against running this command.
After running make for many times, the server successfully runs. I don’t know how
Thank you so much for your help!
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.