DEV Community

loading...

Show DEV: Bingo - The missing package manager for golang binaries

TekWizely
・3 min read

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:

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!
Enter fullscreen mode Exit fullscreen mode

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!
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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


Requirements

Run

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

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 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:

install bingo directly from tap

$ brew install tekwizely/tap/bingo
Enter fullscreen mode Exit fullscreen mode

install tap to track updates

$ brew tap tekwizely/tap

$ brew install bingo
Enter fullscreen mode Exit fullscreen mode

Configuration

See the 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 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 )

Discussion (0)