# Uninstalling a package installed with Go

Have you ever installed a package by using `go install <some-package>` and wondered how to uninstall it?

Go is really great in that respect. Go packages are a single binary and they’re installed based on how your Go tooling is set up.

Provided we have Go installed, when we run `go help install` in the command line, we can see where packages are installed:

> `usage: go install [build flags] [packages]`
> 
> `Install compiles and installs the packages named by the import paths.`
> 
> `Executables are installed in the directory named by the GOBIN environment variable, which defaults to $GOPATH/bin or $HOME/go/bin if the GOPATH environment variable is not set. Executables in $GOROOT are installed in $GOROOT/bin or $GOTOOLDIR instead of $GOBIN.`

So that’s pretty straight-forward. Let’s see where our packages are installed by trying the first command:

```bash
echo $GOPATH
```

If that returns blank, it’s not defined, so we can probably assume they’re going to be installed in `~/go/bin`.

```bash
ls $HOME/go/bin
```

This should return a list of executable binaries installed using `go install`.

## Installing a package with Go

A while back, I built a really simple CLI tool to assist me with testing deep links and statically generated sites that I built. This CLI tool [static-server](https://github.com/tinacious/static-server) allows me to serve the entire contents of a directory as a static website.

As the instructions in the README say, I can install the latest version of the tool using Go with the following command:

```bash
go install github.com/tinacious/static-server@latest
```

Then, I can navigate to any static HTML website folder on my computer and serve it. Let’s assume I have the following directory somewhere:

```plaintext
test
├── index.html
└── style.css
```

I can run the following:

```bash
cd path/to/test
static-server
```

This will serve the contents of the directory on a random port.

## Uninstalling a package installed with Go

Let’s say you’ve tried this tool and you absolutely hate it. You prefer to type out the long Python 3 command, or use an NPM package that depends on you having the correct Node.js runtime on your computer. Here’s how you can uninstall `static-server`.

```bash
which static-server
```

This should output the path to the binary. Simply delete it.

Or, if you’re feeling brave and want to do it in a single line:

```bash
rm $(which static-server)
```
