Uninstalling Go on Mac
Homebrew is good but it introduces some complexity to your development, particularly if you've installed tools manually before they were available via Homebrew.
One of the really problematic tools to move to Homebrew was Go. Because it is installed as a package, removing it is not trivial and may require a lot of manual work after the removal is complete.
Run the following command in a terminal to see if Go was installed using the macOS package
Go macOS package is presented as
com.googlecode.go in the result list. macOS package stores files in the predefined location. For Go version 1.12 these are the files to be deleted:
There is a command line to check if files are moved to a different location in future Go versions:
pkgutil --only-files --files com.googlecode.go
Next, we need to remove the system record of the Go package:
sudo pkgutil --forget com.googlecode.go
Manual cleanup #
We need to check for and remove the following files manually
/etc/paths.d/gois added by macOS package
/usr/local/gois where macOS keeps Go binaries and related files
$GOPATH, the Go Workspace. Be careful as this is where Go puts your code so back it up before removing it
*/go/bin and remove any mentions of Go from the path