Home >Backend Development >Golang >How Do I Uninstall Go Packages Installed with `go get`?
Uninstalling Packages Installed via "go get"
To ensure a clean and organized Go installation, it is crucial to know how to remove packages installed using "go get" command. This becomes necessary when packages are installed outside the designated GOPATH, unintentionally cluttering the root Go install.
How to Remove Go Packages
To successfully remove packages previously installed with "go get," follow these steps:
go get package@none
In this command, "package" represents the name of the package you wish to remove. The version part "@none" effectively sets the package to be removed.
Example:
If you installed the "github.com/foo/bar" package with "go get," you can remove it using the following command:
go get github.com/foo/bar@none
This command will remove the "github.com/foo/bar" package from your Go installation. Note that this action will not delete the package directory or its contents; it merely uninstalls the package and removes its entry from the Go path.
The above is the detailed content of How Do I Uninstall Go Packages Installed with `go get`?. For more information, please follow other related articles on the PHP Chinese website!