golin

package module
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 22 Imported by: 0

README

golin

This command swiching the symbolic link of GOROOT

install

https://github.com/shizuokago/golin/releases

Download the golin that suits your platform.

実行ファイルをPATHに通してください

already Go Runtime installed.

go get github.com/shizuokago/golin/v2/_cmd/golin@latest

GOBIN(GOPATH/bin)に配布されます。GOBINにPATHが通っていることを確認してください。

use

If "go" command does not exit yet,"install"

$ golin install {path} {version}

this will install the latest Go on the "path".

a symbolic link calld "current" is created in "path" with the latest version.

e.g) $ golin install /usr/local/go
/usr/local/go
       |-1.16.5
       |-current -> 1.16.5

you set the environment variable "GOROOT" to "/usr/local/go/current"

examples

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

/usr/local/go/current -
       |-1.16.5
       |-current -> 1.16.5
$ golin 1.17beta1
/usr/local/go/current -
      |-1.16.5
      |-1.17
      |-current -> 1,17

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

Beta and Candidate Release are also available for install.

e.g.) golin 1.17beta1 golin 1.17rc1

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"

Problem installing v2 with "Modules"

It is known to add v2 to the package "go.mod", but when installing the command, it fits the phenomenon that the package cannot be found.

This is a symptom that only happens if the command is installed in a different location, and I think few packages are currently facing this issue.

Only found

https://github.com/golang/appengine/tree/master/v2

I tried to refer to the v2 directory of.

Documentation

Overview

Golin is Switching the symbolic link of GOROOT

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

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

Index

Constants

View Source
const CompileSDK = "compile_sdk"

Variables

This section is empty.

Functions

func CompileLatestSDK

func CompileLatestSDK() error

CompileGoSDK is Compile from the latest repository to Create GoSDK

Create()にCompileSDKを渡すことで開発用のgotipの実行を行います

func Compress

func Compress(w io.Writer, files ...string) error

func CompressReleaseZip

func CompressReleaseZip(dst string, cmd string) error

リリース用のZIPを作成

func Create

func Create(v string) error

Create is create symblic link

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

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

func DecompressURL

func DecompressURL(url string, dir string) error

func Download

func Download(v string) (string, error)

Download is Go download

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

func GetGoEnv

func GetGoEnv(key string) string

GetGoEnv is go env {key} command

go envを引数で実行します

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

func GetGoPath

func GetGoPath() string

GetGoPath is return GOPATH

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

func Install

func Install(path string, ver string) error

func PrintGoVersionList

func PrintGoVersionList() error

PrintGoVersionList is download list printing

インストール可能なバージョンリストを元に並び替えを行い表示します 存在するバージョンには「*」を表示します

Types

type CompressType

type CompressType int
const (
	CompressZip CompressType = iota
	CompressTarGz
	CompressNotSupported
)

type Version

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

Version is r.v.m version

func NewVersion

func NewVersion(src string) *Version

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

func (Version) Less

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

Version less

func (Version) String

func (v Version) String() string

type VersionMean

type VersionMean int
const (
	Major VersionMean = iota
	RC
	Beta
	MeanError
)

func (VersionMean) String

func (m VersionMean) String() string

Notes

Bugs

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

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

Directories

Path Synopsis
v2
_cmd/golin
Golin Command
Golin Command

Jump to

Keyboard shortcuts

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