golin

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2019 License: MIT Imports: 11 Imported by: 0

README

golin

This command swiching the symbolic link of GOROOT

$ go get github.com/shizuokago/golin/cmd/golin

created $GOPATH/bin/golin

examples

GOROOT = /usr/local/go/current -> 1.11.4

/usr/local/go/current -
       |-1.11rc1
       |-1.11.4
       |-current -> 1.11.4
$ golin 1.12
/usr/local/go/current -
       |-1.11rc1
       |-1.11.4
       |-1.12
       |-current -> 1.12

If it does not exist, download it and switch it.

when using for the first time

You should create and manage a management directory.

For example ...

If your GOROOT is "/usr/local/go". This command creates "/usr/local/{version}" and "/usr/local/current". This will "Hachamecha" "/usr/local"

I think that it is better to set it as "/usr/local/go/{nowversion}".

super user

It can only be executed by superuser.(symblik link create)

windows

Please execute command prompt as Administrators.

other(linux or mac)

sudo golin {version}

Because there is a possibility that environment variables are not inherited by sudo,please add the following the /etc/sudoers

Deafaults env_keep += "GOROOT"

Documentation

Overview

Golin is Switching the symbolic link of GOROOT

んなもんDockerでやりゃいい!という思いを跳ね除け、 Shizuoka.goの為に作りましたが、多分secondarykeyはそのままつかいます https://github.com/shizuokago/golin で管理しています

versionが対象ディレクトリに存在しない場合、自動的にダウンロードを行い、 バージョンの切り替えを行ってくれます

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompileLatestSDK added in v1.0.0

func CompileLatestSDK() error

CompileGoSDK is Compile from the latest repository to Create GoSDK

Createに"tip"を渡すことで開発用のgotipの実行を行います

func Create added in v0.7.0

func Create(v string) error

Create is create symblic link

引数でバージョンを指定します GOROOTの確認、権限の確認、パスの準備、リンクの準備(削除) リンクの張り直しを行います

BUG(secondarykey): テストがGo1.12にしてないと通らない

func Download added in v0.7.0

func Download(v string) (string, error)

Download is Go download

Go言語をダウンロードします 戻り値はダウンロードして来たディレクトリを返します

func GetGoEnv added in v0.7.0

func GetGoEnv(key string) string

GetGoEnv is go env {key} command

go envを引数で実行します

TODO(secondarykey) : change replaceall(1.12 after,,,)

func GetGoPath added in v0.7.0

func GetGoPath() string

GetGoPath is return GOPATH

GOPATHの値を返しますが、 設定がない場合もあるのでos.Getenv()ではなくgo env からの値を取得

func Print added in v1.0.0

func Print() error

Print is download list printing

バージョンリストを元に並び替えを行い表示します TODO(secondarykty) : 存在するディレクトリも表示する

Example
package main

import (
	"github.com/shizuokago/golin"
)

func main() {

	err := golin.Print()
	if err != nil {
	}

}
Output:
1.8beta1
1.8beta2
1.8rc1
1.8rc2
1.8rc3
1.8
1.8.1
1.8.2
1.8.3
1.8.4
1.8.5
1.8.6
1.8.7
1.9beta1
1.9beta2
1.9rc1
1.9rc2
1.9
1.9.1
1.9.2
1.9.3
1.9.4
1.9.5
1.9.6
1.9.7
1.10beta1
1.10beta2
1.10rc1
1.10rc2
1.10
1.10.1
1.10.2
1.10.3
1.10.4
1.10.5
1.10.6
1.10.7
1.10.8
1.11beta1
1.11beta2
1.11beta3
1.11rc1
1.11rc2
1.11
1.11.1
1.11.2
1.11.3
1.11.4
1.11.5
1.11.6
1.12beta1
1.12beta2
1.12rc1
1.12
1.12.1

func SetOption added in v0.6.0

func SetOption(op *Option)

SetOption is

Types

type Option added in v0.6.0

type Option struct {
	LinkName string    //リンク名
	StdIn    io.Reader //エラー時の出力場所
	StdErr   io.Writer //エラー時の出力場所
	StdOut   io.Writer //出力場所
}

実行オプション

func DefaultOption added in v0.7.0

func DefaultOption() *Option

DefaultOptoon is golin option

type Version added in v0.9.0

type Version struct {
	// contains filtered or unexported fields
}

Version is r.v.m version

func NewVersion added in v0.9.0

func NewVersion(src string) *Version

Parse version string src = "1.12.1" R,V,M mean = major,rc,beta

func (Version) Less added in v0.9.0

func (src Version) Less(target *Version) bool

Version less

func (Version) String added in v0.9.0

func (v Version) String() string

print source

Notes

Bugs

  • テストがGo1.12にしてないと通らない

  • 作成に失敗した場合のロールバックがない

Directories

Path Synopsis
cmd
golin command
Golin Command
Golin Command

Jump to

Keyboard shortcuts

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