Do you love the simplicity of being able to download & compile golang applications with go install
, but wish it were easier to manage the compiled binaries?
Bingo makes installing and managing go install
-based packages a lot easier.
- Keeps a link between the installed binary and the source package
- Can update / uninstall binaries using the name of the binary (i.e
bingo update goimports
) - 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 binaries)
- Each binary's source packages are isolated and managed in their own separate
$GOROOT
- Compiling + Installing Binaries
- Listing Installed Binaries
- Displaying A Binary's Associated Package
- Updating Binaries
- Uninstalling Binaries / Packages
To install a binary with bingo, use the golang application's full package path, same as you would with "go install"
.
hello example
$ bingo install github.com/golang/example/hello
Installing binary hello from package github.com/golang/example/hello
Downloading & compiling package (folder: '~/.bingo/pkg/hello')
go: downloading github.com/golang/example v0.0.0-20170904185048-46695d81d1fa
go: found github.com/golang/example/hello in github.com/golang/example v0.0.0-20170904185048-46695d81d1fa
Installing binary (file: '~/.bingo/bin/hello')
Done
$ ~/.bingo/bin/hello
Hello, Go examples!
TBD
Currently, bingo only supports packages which can be directly downloaded + compiled + installed via go install
(or go get for pre v1.16).
Packages that require a more complex build process are not supported at this time.
See the Work Folders section for details on configuring the various folders needed by bingo, including which folder to install binaries in.
You can specify which version of a package to install.
install example using @version syntax
$ bingo install github.com/golang/example/[email protected]
install example using --version option
$ bingo install --version v1.2.3 github.com/golang/example/hello
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!
By default, bingo uses go install
to download + compile + install packages.
If you're using a version of go prior to v1.16, you can instruct bingo to use go get
:
install example using --useget option
$ bingo install --useget github.com/golang/example/hello
install example using BINGO_USE_GET variable
$ BINGO_USE_GET=1 bingo install github.com/golang/example/hello
NOTE: Both of these work for the bingo update
command as well.
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
As you see above, installing the hello example as foo
did not interfere with the example installed as hello
.
Each installed binary is managed in a separate $GOROOT
, even if it is has the same package path as another binary.
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
To update an installed binary, use the update
command:
$ bingo update hello
Updating hello package github.com/golang/example/hello
go: found github.com/golang/example/hello in github.com/golang/example v0.0.0-20170904185048-46695d81d1fa
Done
NOTE: By default, the resulting package version will be determined by Go's version resolution rules.
You can specify which version of a package to update to.
NOTE: The target version does not have to be newer than the existing version. i.e you can update to an older version of the package.
update example using @version syntax
$ bingo update [email protected]
update example using --version option
$ bingo update --version v1.2.3 hello
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.
Bingo exists as a Runfile, and requires the Run tool to operate:
Bingo (currently) uses bash
for its command scripts.
Bingo uses symbolic links to associate binaries to their packages.
The scripts use readlink
to resolve symbolic links.
See the Releases page for downloadable archives of versioned releases.
TBD
In addition to working on brew core support, 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
Bingo requires the following work folders:
Folder | Description |
---|---|
Bin Folder | Where compiled binaries are installed. This folder should be in your $PATH . This can be a "shared" folder that also contains non-bingo binaries. |
Package Folder | Where packages are downloaded / compiled. This should NOT be a "shared" folder. |
Cache Folder | Where to store Go cache files. This might work as a shared folder but has not been tested. |
Each of these folders can be individually configured via shell variables:
$BINGO_BIN
$BINGO_PKG
$BINGO_CACHE
If the $BINGO_HOME
variable is defined, bingo will use it as a fall-back for any folder that is not individually configured, i.e:
$BINGO_HOME/bin
$BINGO_HOME/pkg
$BINGO_HOME/cache
As a final default, bingo will use $HOME/.bingo i.e:
$HOME/.bingo/bin
$HOME/.bingo/pkg
$HOME/.bingo/cache
To contribute to Bingo, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
If you want to contact me you can reach me at [email protected].
The tekwizely/bingo
project is released under the MIT License. See LICENSE
file.