Home >Backend Development >Golang >How Do I Uninstall Packages Installed with `go get`?

How Do I Uninstall Packages Installed with `go get`?

Linda Hamilton
Linda HamiltonOriginal
2024-12-03 15:05:11167browse

How Do I Uninstall Packages Installed with `go get`?

Uninstalling Packages Installed with go get

When installing packages using go get without setting GOPATH, the packages are installed under the root Go install location. This can lead to a cluttered installation and make it difficult to manage custom and core Go packages separately. To remove such unwanted packages, follow these steps:

To remove a package previously installed with go get, use the following command:

go get package@none

In this command:

  • package is the name of the package to be removed.
  • @none specifies that the version of the package to be removed is "none". This effectively removes the package.

For example, to remove the util package installed previously, run:

go get util@none

After running this command, the util package will be removed from the root Go install location. You can verify this by running go list and checking if the package is listed.

The above is the detailed content of How Do I Uninstall Packages Installed with `go get`?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn