Delete go folder for updating

Hello everyone,

I want to upgrade my go to the latest version. But before installing the new version I must delete the existing one. My OS is Ubuntu 18.04. So I run rm -rf /usr/local/go but the answer I get is: rm: cannot remove 'go': Permission denied.

I have changed the directory permissions with sudo chmod -R 777 go, but the result is the same.

What do you recommend?

Remove using sudo.

But only if you are really sure that the folder is not “owned” by a package you installed.

How can /usr/local/go/ folder be owned by a installed package?

If you did apt-get install foo and it therefore installed a package that contained that folder.

Not owned in the filesystem sense of it, but “owned” in the context of your package manager.

As far as I can remember, I installed go by downloading the archive and extracting it into /usr/local/ folder.

Then it should be safe to remove it, without confusing your package managers database.

As far as I remember thats even the proposed location of the installation guide on I’m not a huge fan of that practice.

Thanks for help.

What would you recommend?

Using properly packaged software or install in the users home.

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.