Show DEV: Bingo - The missing package manager for golang binaries
Tags: showdev, go, tools
Published: 2020-02-17 20:11:48

## Introduction

Do you love the simplicity of being able to download & compile golang applications with `'go get'`, but wish it were easier to manage the compiled binaries?

Introducing Bingo:

 * GitHub : https://github.com/TekWizely/bingo

Bingo makes installing and managing golang-compiled binaries a bit easier.

### Features

* Keeps a link between the installed binary and the source package
* Can install binaries to a location of your choice
* Can control the name of the installed binary
* Can install multiple versions of the same package (using different names for the binary)
* Each binary's source package is isolated and managed in its own separate `$GOROOT`

---
## Examples

### Compiling + Installing Binaries

To install a binary with bingo, use the golang application's full package path, same as you would with `'go get'`.

_hello example_
```
$ bingo install github.com/golang/example/hello

Installing binary hello from package github.com/golang/example/hello
Downloading package (folder: '~/.bingo/pkg/hello')
Compiling package
Installing binary (file: '~/.bingo/bin/hello')
Done

$ ~/.bingo/bin/hello

Hello, Go examples!
```

#### Binary Naming

By default, the installed binary will be named after the last folder element in its package path.

As you saw above, installing the `github.com/golang/example/hello` package installed a binary named `hello`.

You can override this behavior and specify the binary name at the time of installation:

_install hello example as 'foo'_
```
$ bingo install -n foo -q github.com/golang/example/hello

$ ~/.bingo/bin/foo

Hello, Go examples!
```

### Listing Installed Binaries

To see a list of installed binaries, use the `installed` command:

```
$ bingo installed -p

Bingo-managed binaries (folder: '~/.bingo/bin')

 - foo github.com/golang/example/hello
 - hello github.com/golang/example/hello
```

## Displaying A Binary's Associated Package

If you need a reminder of which package a binary was compiled/installed from, you can use the `package` command:

```
$ bingo package hello

github.com/golang/example/hello
```

### Uninstalling Binaries / Packages

Use the `uninstall` command to uninstall binaries:

```
$ bingo uninstall foo

Uninstalling binary foo from package github.com/golang/example/hello
Removing binary (file: '~/.bingo/bin/foo')
Removing package (folder: '~/.bingo/pkg/foo')
Done

$ bingo installed -q

hello
```

*NOTE*: Uninstalling a binary also removes the associated package folder.

---
## Requirements

### Run

Bingo exists as a Runfile, and requires the Run tool to operate:

* https://github.com/TekWizely/run

### Bash

Bingo (currently) uses `bash` for its command scripts.

### Readlink

Bingo uses symbolic links to associate binaries to their packages.

The scripts use `readlink` to resolve symbolic links.

---
## Installing Bingo

### Releases

See the [Releases](https://github.com/TekWizely/bingo/releases) page for downloadable archives of versioned releases.

### Brew Tap

While brew core support is in the works, I have also created a tap to ensure the latest version is always available:

* https://github.com/TekWizely/homebrew-tap

_install bingo directly from tap_
```
$ brew install tekwizely/tap/bingo
```

_install tap to track updates_
```
$ brew tap tekwizely/tap

$ brew install bingo
```

---
## Configuration

See the [Work Folders](https://github.com/TekWizely/bingo#work-folders) section on the project's main page for details on configuring the various folders needed by bingo, including which folder to install binaries in.

---
## License

The `tekwizely/bingo` project is released under the [MIT](https://opensource.org/licenses/MIT) License.

---
## Conclusion - A Toy Trying To Take Itself Seriously

Although designed as a set of toy scripts to play around with the idea, bingo is trying to take itself seriously and make a real run at being a useful tool.

If you're looking for better ways to manage binaries installed via `'go get'`, I hope you will give my project a try.

I am happy to answer any questions you might have.

Thank you for your time,

-TekWizely ( https://github.com/TekWizely )