Create and manage Isolated Virtual Environments for Go

VenGO

Build Status

Create and manage Isolated Virtual Environments for Golang.

Motivation

Why a tool to generate and manage virtual environments in Go?. Well, sometimes programmers need to work in or maintain a project that requires a specific version of Go or use specific versions of 3rd party libraries that maybe depend themselves on some specific Go version.

There are already tools like godep to vendoring dependencies and make the programmer able to build a package in consistent way reproducing the exact package ecosystem that was used when it was developed and Go versions managers like gvm that helps the programmer to install and use different Go versions. But there is no a tool that can do both and in an easy and familiar way.

VenGO is able to install as many Go versions from as many sources that programmers want and to create as many isolated environments as they need using one or more Go versions. The programmers can then export and import VenGO environments from and to machines using the export and import commands.

Platforms and Support

VenGO works and is actively maintained in POSIX platforms, it requires go1.2 or higher to be compiled

Platform Status Maintainer
GNU/Linux Stable @damnwidget
FreeBSD Stable
OS X Stable @damnwidget
Windows Garbage

note: Support for Windows is planned

Installation

VenGO can be installed following two simple steps

1 Install the tools

Install VenGO and it's dependencies

With wget

wget --no-check-certificate https://raw.github.com/DamnWidget/VenGO/master/install.sh -O - | bash

With curl

curl -L https://raw.github.com/DamnWidget/VenGO/master/install.sh | bash

2 Enable the vengo application in your shell

Finally the command below will enable the vengo command in your system

$ source $HOME/.VenGO/bin/vengo

3 Optional

If you want to enable vengo in permanent basis in your system, you can add it to your .bashrc, .zshrc or .profile files like

echo "source $HOME/.VenGO/bin/vengo" >> $HOME/.bashrc

Fish users

If you are a fish user, you will probably copy and paste the code below to make your vengo installation work.

note: copy one or another depending of which tool (curl or wget) do you want to use

With curl
mkdir -p ~/.config/fish/functions; curl https://raw.githubusercontent.com/DamnWidget/VenGO/master/tools/fish/vengo.fish > ~/.config/fish/functions/vengo.fish; curl https://raw.githubusercontent.com/DamnWidget/VenGO/master/tools/fish/vengo_activate.fish > ~/.config/fish/functions/vengo_activate.fish
With wget
mkdir -p ~/.config/fish/functions; wget --no-check-certificate https://raw.githubusercontent.com/DamnWidget/VenGO/master/tools/fish/vengo.fish -O ~/.config/fish/functions/vengo.fish; wget --no-check-certificate https://raw.githubusercontent.com/DamnWidget/VenGO/master/tools/fish/vengo_activate.fish -O ~/.config/fish/functions/vengo_activate.fish

Fish users should use the command vengo_activate instead of vengo activate to activate environments.

Usage

VenGO is quite similar to Python's virtualenvwrapper tool, if you execute just vengo with no arguments you will get a list of available commands. The most basic usage is install a Go version

note: VenGO is not able to use Go installations that has not been made with VenGO itself

The following command will install Go 1.2.2 from the mercurial repository:

$ vengo install go1.2.2

This install the go1.2.2 version into the VenGO's cache and generates a manifest that guarantee the installation integrity, now the programmer can create a new environment using the just installed Go version

note: VenGO supports installation of go1.5 and superior using the -bootstrap (or -x) flag and a valid go1.4 vengo root)

$ vengo mkenv -g go1.2.2 MyEnv

This will create a new isolated environment that uses go1.2.2 and uses $VENGO_HOME/MyEnv as GOPATH

To activate this new environment thw programmer just have to use vengo activate with the name of the recently created environment

$ vengo activate MyEnv

Now, whatever is installed using go get will be installed in the new isolated virtual go environment. It's GOPATH bin will be already added to the programmer PATH so new applications should be available in the command line after installation.

To stop using the active environment just execute

$ deactivate

Detailed guide on VenGO commands

VenGO comes with ten different commands that will be used trough the vengo command line application VenGO no arguments

VenGO install

Vengo install is used to install new versions of Go, it can install them directly from the official mercurial repository, from a tar.gz packed source or directly in binary format in case that the user doesn't want to compile it. VenGO Install

Install will download the sources from the official mercurial repository by default, then check and copy the specific version into a directory (in the VenGO cache directory) named as the version itself, compile it and generate a manifest for the installation. To download from a packaged tar.gz source use the -s or --source flag like in:

$ vengo install -s 1.3.3

In similar way, to download from a binary source use the -b or --binary flag like in:

$ vengo install -b 1.3.3

VenGO list

Vengo list is used to show a list of installed Go versions, available Go versions or both. If the list command detects that a installed Go version integrity is compromised, it will display a red mark, a green mark if not VenGO List

If the -n or --non-installed flag is passed to the list command, a complete list of available sources is returned back to the user ordered by binary, mercurial and tar.gz packed versions.

How do I know from which source is each version?

Versions that are prefixed like 1.2.2.<platform>-<arch> are binaries, note that is not neccesary to add the platform and architecture to the install command to donwload the version so for example if the list command return to us that the version 1.3.3.darwin-amd64-osx10.8 is available, we will write just:

$ vengo install --binary 1.3.3

The install command is smart enough to know that we are using a 64bits OS X and it's version, it will work in the exact same way on GNU/Linux and Windows

note: Windows support is not complete yet

Versions prefixed with go or release like go1.1 or release.r56 come from the official mercurial repository, the install command doesn't need any special flag to use it as it's the default download option, note that is not needed to add the go prefix neither but is a good practice to use it just to avoid confusion.

Finally, all the versions that doesn't have any prefix or suffix are tar.gz packaged versions of the source, just pass the --source flag to the install command in other to download them.

VenGO uninstall

Vengo uninstall is used to uninstall a Go installed version, it doesn't remove any Virtual Go Environment that has been created using the deleted version but it will be shown by the lsenvs command as integrity compromised.

VenGO mkenv

Vengo mkenv is used to create new Isolated Virtual Go Environments, the Go version to use must be specified as argument for the parameter -g or --go, if no version is pased, tip is tried to be used automatically. VenGO Install

Vengo mkenv will use the name of the environment as prefix of the terminal prompt when the user switch to an environment using vengo activate but the users can specify whatever other prompt that they like passing a string to the parameter -p or --prompt so for exmample:

$ vengo mkenv -p "(VenGO [go1.4rc1])" -g go1.4rc1 vengo_go14rc1

Will give you a prompt like this one when you switch to it, (VenGO [go1.4rc1]) damnwidget@iMacStation ~ $

You can also force the environment reinstallation passing the flag -f or --force in case that the environment already exists

VenGO lsenvs

Vengo lsenvs is used to list Isolated Virtual Go Environments in your system. Integrity compromised environments will be shown with a red mark, a green mark will be shown otherwise VenGO Lsenvs

VenGO rmenv

Vengo rmenv is used to delete Virtual Go Environments, delete an environment doesn't affect the Go version used to install the environment or other environments using that Go version

VenGO export

Vengo export is used to export VenGO environments into vengo manifest files in JSON format that can be used later by the vengo import command to recreate a previously exported VenGO environment. VenGO generates a JSON file that contains all the packages that have been installed into the active VenGO environment GOPATH using go get (that means git, mercurial, bazaar or subversion had been used to install those packages previously) capturing the specific revisions used when the package was installed.

This manifest can be then used by anyone that has access to it with the command vengo import to generate the exact same environment in their own. VenGO will clone the packages in the manifest in the exact specific version in the newly import VenGO environment GOPATH. This is similar to what godep does but for the whole GOPATH and without packing the code in a sub-directory or rewritting import paths.

note: probably godep is still a more secure option as VenGO import still depends on network access and remote VCS systems.

note: VenGO also works with gopkg.in and semver.v1

VenGO import

Vengo import is ised to recreate environments previously exported with the command vengo export

VenGO vengo-uninstall

Vengo vengo-uninstall will delete all the environments, Go versions and VenGO installation itself.

## License

This Source is released under the terms of the General Public License (GPLv2)

Copyright (C) 2014  Oscar Campos <[email protected]>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

See LICENSE file for more details.
Comments
  • Does not seem to properly alias 'vengo' command: OS X 10.10.1

    Does not seem to properly alias 'vengo' command: OS X 10.10.1

    DamnWidget,

    Awesome job creating this tool, it is a necessary for me to have an easy tool to spin up Go environments without the added work of managing paths.

    I'm using Yosemite, with what appears to be a proper install of VenGO ($HOME/.VenGO/bin/vengo.sh exists) and go version:

    go version go1.3.2 darwin/amd64

    I've got the vengo.sh properly loading in my bashrc. However, when I hit 'vengo', I get the following error:

    $HOME/.VenGO/bin/vengo: No such file or directory

    Any thoughts on why this may be?

  • Export/Import feature

    Export/Import feature

    The basic idea around this feature is to be able to "freeze" the Go version and packages in $GOPATH versions into some kind of metadata format that make anyone able to import or re assemble any VenGO environment to allow build reproducibility.

    The feature should be flexible enough to allow two different types of exports, a heavy export a la godep or a light export that doesn't include any actual code (putting you, your code, and your code consumers in the hands of the vcs central repositories hands)

  • Move the imports to relative paths

    Move the imports to relative paths

    We need to call vengo activate from the same terminal session that is running in order to modify the environment variables of the terminal itself, there is no way for a child process to modify the environment variables of its parent so this is why the vengo command is just a bash function and no a real Go binary,

    Right now, VenGO has to be downloaded using go get github.com/DamnWidget/VenGO and then cd to $GOPATH and run the make command that builds each individual binary and copy the BASH stuff to the $VENGO_HOME directory, it feels just wrong and weird.

    VenGO is not a typical Go package that can/should be installed using go get so there is no need to use github.com/DamnWidget/VenGO as import path. Move it to relative imports feels like the right thing to do, at least seems more natural and make us able to compile the sources outside any GOPATH workspace.

    After moving the code to relative imports we should be able to install VenGO as:

    git clone https://github.com/DamnWidget/VenGO vengo
    cd vengo
    make install
    
  • Support for new Github golang repo in `vengo install`

    Support for new Github golang repo in `vengo install`

    Currently, vengo supports download, compile and install Go source code from the official mercurial repository. Recently, Golang authors announced the migration of the Go project to Github so vengo install should support it

  • Command 'activate' doesn't looks like a valid VenGO command.

    Command 'activate' doesn't looks like a valid VenGO command.

    The manual you wrote, use command "vengo activate [name]" to activate enviriement, but is command not working. I run from ubuntu command line.

  • can't compile any go version

    can't compile any go version

    Hello, I am running yosemite on my mac and anytime I try to install anything I get an error. Here is one of them:

    Installed Go for darwin/amd64 in /Users/apple/Library/Caches/VenGO/go1.2.2 Installed commands in /Users/apple/goWork/bin stat /Users/apple/Library/Caches/VenGO/go1.2.2/bin/go: no such file or directory error: Go go1.2.2 wasn't compiled properly! stat /Users/apple/Library/Caches/VenGO/go1.2.2/bin/go: no such file or directory

    I get this error with any version I attempt to install.

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go.

Package core is a service container that elegantly bootstrap and coordinate twelve-factor apps in Go. Background The twelve-factor methodology has pro

Nov 3, 2022
Fetch license information for all direct and indirect dependencies of your Golang project
Fetch license information for all direct and indirect dependencies of your Golang project

gocomply beta Give open source Golang developers the credit they deserve, follow your legal obligations, and save time with gocomply. This tiny little

Nov 1, 2022
🦄 Easy, fast and open-source local package manager for Python!

Unikorn ?? Easy, fast and open-source local package manager for Python! Key Features Speed: You can add a package in one second.

Dec 11, 2021
GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows.

GoFish is a cross-platform systems package manager, bringing the ease of use of Homebrew to Linux and Windows.

Dec 11, 2022
Create isolated environments for installing Go packages. Similar to virtualenv for Python.

DEPRECATED: This project is no longer maintained. Goenv Goenv lets you create an isolated environment where you install Go packages, binaries, or even

Jul 15, 2021
This is a tool to interact with Apigee APIs. The tool lets you manage (create, del, get, list) environments, proxies, etc.

apigeecli This is a tool to interact with Apigee APIs for Apigee hybrid and Apigee's managed offering. The tool lets you manage (Create,Get, List, Upd

Dec 3, 2022
Virtual-Operating-System - Virtual Operating System Using Golang And Fyne Implemented Gallery app
Virtual-Operating-System - Virtual Operating System Using Golang And Fyne Implemented Gallery app

Virtual Operating System Virtual Operating System Using Golang And Fyne Implemen

Jan 1, 2022
Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.
Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) Open Service Mesh (OSM) is a lightweight, extensible, Cloud Native service mesh that allows users to uniformly manage, secure,

Jan 2, 2023
An interactive command-line tool to manage your environments
An interactive command-line tool to manage your environments

goto An interactive command-line tool to manage your environments Overview You always need to login to some Linux machine or connect to a MySQL instan

Jul 11, 2022
Conda-boxes - A Kubernetes Controller CLI to manage Conda environments as volumes or Boxes

conda-boxes A Kubernetes Controller CLI to manage Conda environments as volumes

Mar 20, 2022
Testing framework for Go. Allows writing self-documenting tests/specifications, and executes them concurrently and safely isolated. [UNMAINTAINED]

GoSpec GoSpec is a BDD-style testing framework for the Go programming language. It allows writing self-documenting tests/specs, and executes them in p

Nov 28, 2022
📖 Build a RESTful API on Go: Fiber, PostgreSQL, JWT and Swagger docs in isolated Docker containers.
📖 Build a RESTful API on Go: Fiber, PostgreSQL, JWT and Swagger docs in isolated Docker containers.

?? Tutorial: Build a RESTful API on Go Fiber, PostgreSQL, JWT and Swagger docs in isolated Docker containers. ?? The full article is published on Marc

Dec 27, 2022
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.
Kubernetes Virtualization API and runtime in order to define and manage virtual machines.

Kubernetes Virtualization API and runtime in order to define and manage virtual machines.

Jan 5, 2023
Immutable transaction isolated sql driver for golang

Single transaction based sql.Driver for GO Package txdb is a single transaction based database sql driver. When the connection is opened, it starts a

Jan 6, 2023
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
Demo Fully Isolated System Architecture

Fully Isolated System Architecture (Microservices) Arsitektur Request | | | Api Gateway --- Auth Provider |\________________________

Dec 13, 2022
Create virtual machines and run Linux-based operating systems in Go using Apple Virtualization.framework.

vz - Go binding with Apple Virtualization.framework vz provides the power of the Apple Virtualization.framework in Go.

Jan 9, 2023
vcluster - Create fully functional virtual Kubernetes clusters - Each cluster runs inside a Kubernetes namespace and can be started within seconds
vcluster - Create fully functional virtual Kubernetes clusters - Each cluster runs inside a Kubernetes namespace and can be started within seconds

Website • Quickstart • Documentation • Blog • Twitter • Slack vcluster - Virtual Clusters For Kubernetes Lightweight & Low-Overhead - Based on k3s, bu

Jan 4, 2023
Kubegres is a Kubernetes operator allowing to create a cluster of PostgreSql instances and manage databases replication, failover and backup.

Kubegres is a Kubernetes operator allowing to deploy a cluster of PostgreSql pods with data replication enabled out-of-the box. It brings simplicity w

Dec 30, 2022
Tool (in Go!) to compare and diff container and host environments. Dinosaur fun!

Compenv compare environments between containers, and host ??️ This is a simple tool to compare environments. This means the environment on your host v

Sep 24, 2022