Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
February 17, 2020 08:11 pm GMT

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

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/helloInstalling binary hello from package github.com/golang/example/helloDownloading package (folder: '~/.bingo/pkg/hello')Compiling packageInstalling binary (file: '~/.bingo/bin/hello')Done$ ~/.bingo/bin/helloHello, 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/fooHello, Go examples!

Listing Installed Binaries

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

$ bingo installed -pBingo-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 hellogithub.com/golang/example/hello

Uninstalling Binaries / Packages

Use the uninstall command to uninstall binaries:

$ bingo uninstall fooUninstalling binary foo from package github.com/golang/example/helloRemoving binary (file: '~/.bingo/bin/foo')Removing package (folder: '~/.bingo/pkg/foo')Done$ bingo installed -qhello

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

install tap to track updates

$ brew tap tekwizely/tap$ brew install bingo

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 )


Original Link: https://dev.to/tekwizely/show-dev-bingo-the-missing-package-manager-for-golang-binaries-4bee

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To