gobrew

package module
v1.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2021 License: MIT Imports: 12 Imported by: 0

README

Build Status

Branch Status
master Test
develop Test

gobrew

Go version manager

Install or update

With curl

$ curl -sLk https://git.io/gobrew | sh -

or install using go

$ go get -u github.com/kevincobain2000/gobrew/cmd/gobrew

Add GOPATH & PATH setting your shell config file (.bashrc or .zshrc).

export PATH="$HOME/.gobrew/current/bin:$HOME/.gobrew/bin:$PATH"

Reload config.

All DONE!

(optional)

export GOPATH="$HOME/.gobrew/current/go"
Confirm
$ gobrew help
Usage

Will install and set Go

$ gobrew use 1.16

Will only install it

$ gobrew install 1.16
$ gobrew use 1.16

Uninstall a version

$ gobrew uninstall 1.16

List installed versions

$ gobrew ls

1.15.8
1.16*

current: 1.16

List available versions

$ gobrew ls-remote

...
1.15.1
1.15.2
1.15.3
1.15.4
1.15.5
1.15.6
1.15.7
1.15.8
...
1.16
1.16beta1
1.16rc1

All commands

$ gobrew help                         Show this message
$ gobrew use <version>                Use <version>
$ gobrew install <version>            Download and install <version> (from binary))
$ gobrew uninstall <version>          Uninstall <version>
$ gobrew list                         List installed versions
$ gobrew ls                           Alias for list
$ gobrew ls-remote                    List remote versions
$ gobrew self-update                 	Self update this tool

Setup Go in Github actions

on: [push, pull_request]
name: Test
jobs:
  test:
    strategy:
      matrix:
        go-version: [1.13, 1.14, 1.15, 1.16.7, 1.17rc1, 1.17rc2]
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
    - name: Set Env
      run: |
         echo "GOPATH=$HOME/.gobrew/current/go" >> $GITHUB_ENV
         echo "$HOME/.gobrew/bin" >> $GITHUB_PATH
         echo "$HOME/.gobrew/current/bin" >> $GITHUB_PATH
    - name: Install Gobrew
      run: |
         curl -sLk https://git.io/gobrew | sh -
         gobrew use ${{ matrix.go-version }}
         go version

    - name: Checkout code
      uses: actions/checkout@v2

    - name: Go version
      run: go version

Screenshots

colors-ls-remote colors-ls

Change Log

  • v1.2.0 - Added rc|beta versions, appended at the end of list

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	ListVersions()
	ListRemoteVersions()
	CurrentVersion() string
	Uninstall(version string)
	Install(version string)
	Use(version string)
	Helper
}

Command ...

type GoBrew

type GoBrew struct {
	Command
	// contains filtered or unexported fields
}

GoBrew struct

func NewGoBrew

func NewGoBrew() GoBrew

NewGoBrew instance

func (*GoBrew) CurrentVersion

func (gb *GoBrew) CurrentVersion() string

CurrentVersion get current version from symb link

func (*GoBrew) Install

func (gb *GoBrew) Install(version string)

Install the given version of go

func (*GoBrew) ListRemoteVersions

func (gb *GoBrew) ListRemoteVersions()

ListRemoteVersions that are installed by dir ls

func (*GoBrew) ListVersions

func (gb *GoBrew) ListVersions()

ListVersions that are installed by dir ls highlight the version that is currently symbolic linked

func (*GoBrew) Uninstall

func (gb *GoBrew) Uninstall(version string)

Uninstall the given version of go

func (*GoBrew) Use

func (gb *GoBrew) Use(version string)

Use a version

type Helper

type Helper interface {
	// contains filtered or unexported methods
}

Helper ...

Directories

Path Synopsis
cmd
gobrew command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL