Manage Go Versions/Projects/Dependencies

rodent

Build Status

rodent is a shell (bash) application which:

  • Manages multiple versions of Go.
  • Allows you to test/build your projects against multiple Go releases at ease.
  • Allows cross-compile builds for different platform targets (cgo/stdlib workaround).
  • Manages/tracks librairies dependencies by expanding the GOPATH
  • Create separate workflows within a project per environment (i.e: build projectA with ENV="PRD" on go1.2.2 and ENV="DEV" on go1.3beta2)

This is achieved without getting in your way or hijacking your shell executables/builtins by making use of shims.

In a nutshell

Screencasts

Manage multiple versions:

asciicast

rodentrc usage:

asciicast

$ rodent
Usage: rodent [command] [args]
       help        Display the help
       set         Set a version of Go
       init        Init current shell
       install     Install a version of Go
       versions    Display installed/in-use version(s)
       uninstall   Uninstall a version of Go

       system      Maintenance routines

For more information, checkout the Wiki

Install

git clone http://github.com/alouche/rodent.git /my/path/to/rodent

# Add in your .bashrc, profile etc.

[[ -s "/my/path/to/rodent" ]] && source "/my/path/to/rodent"

# Restart your existing shell or open an new one and you are set. Type "rodent".

Highlight Features

  • Define a specific go version per project source/directory
echo "gover=go1.2.2" >> .rodentrc

# Build your project
go build

# Want to switch between multiple go versions in the same project (for testing new builds)
echo "gover_ATAG=go1.3beta2" >> .rodentrc

# Export your tag as variable
export RODENT_ENV=ATAG

# Build your project
go build

Any rodent variables when suffixed with "_" are scopped as variables for the defined enviroment scope ; variables without these suffixes are used as default variables

  • Keep track of your project third party libraries
echo "godeps=/my/project/workspace" >> .rodentrc

# A dependency target per environment? easy...
echo "godeps_production=./local/prd/path" >> .rodentrc
echo "godeps_development=./local/dev/path" >> .rodentrc
  
# Fetch your dependencies
export RODENT_ENV=production
go get

# Alternatively
export RODENT_ENV=experimental
go build

You get the idea... for more information, please refer to the rodentrc guide.

Update rodent

rodent system -u

Cross-compilation

Please refer to cross-compilation environment

Why this project?

  • I wanted something light/small which allowed all the above while being transparent and out of the way.
  • Managing and tracking my third party libraries by maintaining a separate directory per project which I could simply "tar; cp and or even git submodule.."
  • I prefer using a custom GOPATH per project (or sometimes have a unique GOPATH for a subset of projects) and wanted to keep the "standard go workflow way of things" while maintaining that flexiblity/option.
  • This is an experiment.

Disclaimer

This project is relatively new and not perfect. It still requires a lot of work and does not pretend to be better than the numerous awesome tools the Golang community has created. It is just one way of tackling "Go version and dependency management", if you like it, use it and feel free to contribute.

Contributing

rodent is not locked to a specific way of doing things, so if you have or found a better way to do things or tackle some of the challenges listed here, then I would love to hear of it, so "Go" forth - fork, patch, submit and inspire. The only dependency is that rodent should remain non-intrusive to the user's workflow and relatively light.

Other tools in the same category

License

(The MIT License)

Copyright (c) 2014 Ali Abbas

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Comments
  • bad substitution - error while install

    bad substitution - error while install

    Sorry to open one more ticket, I didn't really tested well. #1 is fixed, but now some other errors.

    09:19 $ rodent -h
    Usage: rodent [command] [args]
           help        Display the help
           set         Set a version of Go
           install     Install a version of Go
           versions    Display installed/in-use version(s)
           uninstall   Uninstall a version of Go
    
           system      Maintenance routines
    ~/gothings/src/github.com/test_rodent 
    09:19 $ rodent system -u
    Already up-to-date.
    rodent v0.1.2-8-g04062a4
    ~/gothings/src/github.com/test_rodent 
    09:19 $ rodent install -l
    Available versions:
     go1.4beta1
     go1.3.3
     go1.3.2
     go1.3.1
     go1.3rc2
     go1.3rc1
     go1.3
     go1.2.2
     go1.1.2
     go1.1.1
     go1.1beta1
     go1.1
     go1.0.3
     go1.0.2
     go1.0.1
     gogo1
    ~/gothings/src/github.com/test_rodent 
    09:19 $ rodent install go1.2.2
    /Users/kishore/rodent/functions/helpers: line 92: ${platform,,}: bad substitution
    /Users/kishore/rodent/functions/helpers: line 92: ${platform,,}: bad substitution
    usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
           mktemp [-d] [-q] [-u] -t prefix 
    /Users/kishore/rodent/functions/logging: line 4: ${msg^}: bad substitution
    ~/gothings/src/github.com/test_rodent 
    09:19 $ rodent install go1.3
    /Users/kishore/rodent/functions/helpers: line 92: ${platform,,}: bad substitution
    /Users/kishore/rodent/functions/helpers: line 92: ${platform,,}: bad substitution
    usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
           mktemp [-d] [-q] [-u] -t prefix 
    /Users/kishore/rodent/functions/logging: line 4: ${msg^}: bad substitution
    ~/gothings/src/github.com/test_rodent 
    09:20 $ 
    
  • not working with go1.1

    not working with go1.1

    I couldn't get it working for go1.1 ... here are the errors I am using MacOS 10.9.5.

    ~/gothings/src/test_rodent/rodent1 
    20:46 $ rodent install go1.1
    # Downloading golang source go1.1
    # Untarring binary to /Users/kishore/rodent/releases
    # Building C bootstrap tool.
    cmd/dist
    
    # Building compilers and Go bootstrap tool for host, darwin/amd64.
    lib9
    libbio
    libmach
    misc/pprof
    ..
    ..
    ..
    testing/iotest
    testing/quick
    # runtime/cgo
    clang: warning: argument unused during compilation: '-pthread'
    # runtime/cgo
    clang: error: no such file or directory: 'libgcc.a'
    error: compilation failed - installation aborted
    
  • readlink: illegal option -- f

    readlink: illegal option -- f

    readlink: illegal option -- f
    usage: readlink [-n] [file ...]
    Usage: rodent [command] [args]
           help        Display the help
           set         Set a version of Go
           install     Install a version of Go
           versions    Display installed/in-use version(s)
           uninstall   Uninstall a version of Go
    

    I get this error when I add to the ~/.bash_profile and did a source ~/.bash_profile

  • Supported platform match is not exact match

    Supported platform match is not exact match

    current:

    rodent install -p freebsd go1.4
    # go version go1.4 for platform linux_amd64 is already installed
    # downloading binary distribution go1.4.freebsd-freebsd.tar.gz
    error: the download failed, please retry later...
    

    should be:

    # go version go1.4 for platform linux_amd64 is already installed
    # this platform bla is not supported, skipping...
    
  • Feed RODENT_GO_RELEASES with git tags fetch

    Feed RODENT_GO_RELEASES with git tags fetch

    Versions are tracked in "RODENT_GO_RELEASES" under share/releases since previously Go releases were split across legacy and new download pages. Although Rodent allows installing a non-referenced release with the "-f" option, since the move to Git, we can now re-use git tags to automatically feed versions into RODENT_GO_RELEASES so that user may directly see the latest releases prio to share/releases being updated.

  • Add flag to force installation of non referenced upstream versions

    Add flag to force installation of non referenced upstream versions

    Current, releases are referenced in RODENT_GO_RELEASES under share/releases. Installation should be allowed to continue if user believes the release is available upstream but not yet referenced in RODENT_GO_RELEASES.

Related tags
Add, remove, and manage different versions of web-distributed software binaries. No elevated permissions required!
Add, remove, and manage different versions of web-distributed software binaries. No elevated permissions required!

A cross-platform package manager for the web! Add, remove, and manage different versions of web-distributed software binaries. No elevated permissions

Nov 21, 2022
A simple multi-layered config loader for Go. Made for smaller projects. No external dependencies.

gocfg ⚠️ Work in progress! A simple multi-layered config loader for Go. Made for smaller projects. No external dependencies. Example From main.go: //

Dec 26, 2021
Clones github projects into ~/Projects/github/{org}/{repo}

Tidy clone Github cli extension (gh extension) to clone repos into ~/Projects/github/{org}/{repo} on the local filesystem Install gh extension install

Jan 19, 2022
Some useful tools to help manage attachments in my local markdown projects.

Some useful tools to help manage attachments in my local markdown projects.

Oct 8, 2022
Shell script to download and set GO environmental paths to allow multiple versions.
Shell script to download and set GO environmental paths to allow multiple versions.

gobrew gobrew lets you easily switch between multiple versions of go. It is based on rbenv and pyenv. Installation The automatic installer You can ins

Nov 3, 2022
Terraform Provider for Latest HashiCorp Product Versions

terraform-provider-hashicorpversions The purpose of this Terraform provider is to get the latest semantic version of any of the suite of HashiCorp too

May 16, 2022
Basic Kubernetes operator that have multiple versions in CRD. This operator can be used to experiment and understand Operator/CRD behaviors.

add-operator Basic Kubernetes operator that have multiple versions in CRD. This operator can be used to experiment and understand Operator/CRD behavio

Dec 15, 2021
A tool that scans archives to check for vulnerable log4j versions

log4j-sniffer log4j-sniffer crawls for all instances of log4j that are earlier t

Dec 14, 2022
Output all versions of a local git repo, which could be used as test data for your ML program.

gitwalker Output all versions of a local git repo, which could be used as test data for your ML program. Notice This program is under development. Cur

Dec 27, 2021
Dockpin - A tool for pinning Docker image and apt package versions

Dockpin Install dockpin with: go install github.com/Jille/dockpin@latest Dockpin

Dec 20, 2022
Seatsserver - Combined frontend and backend to serve HTML versions of seats
Seatsserver - Combined frontend and backend to serve HTML versions of seats

seatsserver Combined frontend and backend to serve HTML versions of github.com/s

Jan 28, 2022
Collect data about your dependencies

Collect data about your dependencies Features and Data Sources: Go modules, runs tests, detects tests and benchmarks Flexible rendering with Graphviz,

Dec 20, 2022
A lightweight Vault client module written in Go, with no dependencies, that is intuitive and user-friendly

libvault A lightweight Hashicorp Vault client written in Go, with no dependencies. It aims to provide an intuitive, simple API that is easy to use. Ju

Sep 18, 2022
Terraform Controller manages the life cycles of a terraform resource, allowing developers to self-serve dependencies in a controlled manner.
Terraform Controller manages the life cycles of a terraform resource, allowing developers to self-serve dependencies in a controlled manner.

TERRAFORM CONTROLLER Terraform Controller manages the life cycles of a terraform resource, allowing developers to self-serve dependencies in a control

Dec 15, 2022
Automated configuration documentation library for Go Projects.

Cato Cato is an automated documentation generation library for Go Projects. Through the use of custom tags for struct fields, Cato can extract informa

Aug 28, 2020
Hermit manages isolated, self-bootstrapping sets of tools in software projects.

Hermit - uniform tooling for Linux and Mac Hermit installs tools for software projects in self-contained, isolated sets, so your team, your contributo

Jan 3, 2023
💻 A one-line installer for GitHub projects!
💻 A one-line installer for GitHub projects!

instl Instl is an installer that can install most GitHub projects on your system with a single command. Installation | Documentation | Contributing In

Jul 23, 2022
💻 A installer for GitHub projects!
💻 A installer for GitHub projects!

instl Instl is an installer that can install most GitHub projects on your system with a single command. Installation | Documentation | Contributing In

Nov 2, 2022
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.
Hassle-free minimal CI/CD for git repositories with docker or docker-compose projects.

GIT-PIPE Hassle-free minimal CI/CD for git repos for docker-based projects. Features: zero configuration for repos by default automatic encrypted back

Sep 23, 2022