gosdk

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2023 License: MIT Imports: 13 Imported by: 1

Documentation

Overview

Package gosdk 提供查找本机 go sdk 路径的功能 会从环境变量 $PATH 和目录 ~/sdk/ 查找

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoDisableGoWork added in v0.0.3

func AutoDisableGoWork() error

func Default

func Default() string

Default 返回 $PATH 里的 "go" 二进制文件的路径,若不存在,会返回空

func DefaultOrLatest

func DefaultOrLatest() string

DefaultOrLatest 查找 $PATH 里的 "go" 二进制文件的路径 或者是最高版本的 go 若没有,也会返回 "go"

func GoCmdEnv

func GoCmdEnv(goBin string, env []string) []string

GoCmdEnv 根据 goBin 路径返回设置了 GOROOT 的环境变量

func Latest

func Latest() string

Latest 返回最新版本的 Go 的路径,若不存在,会返回空

func LatestOrDefault

func LatestOrDefault() string

LatestOrDefault 返回最新版本,或者是 $PATH 里的 go 版本, 若没有,也会返回 "go"

func List

func List() []string

List 返回当前机器所有安装的,可用的 'go' 的地址 版本由高到低排序 若没有,会返回空

func MustAutoDisableGoWork added in v0.0.3

func MustAutoDisableGoWork()

func TryAutoDisableGoWork added in v0.0.3

func TryAutoDisableGoWork()

func Update

func Update()

Update 更新默认的环境信息

Types

type SDK

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

SDK 查找当前机器的 Go SDK 情况

func (*SDK) Default

func (gs *SDK) Default() string

Default 返回 $PATH 里的 "go" 二进制文件的路径,若不存在,会返回空

func (*SDK) DefaultOrLatest

func (gs *SDK) DefaultOrLatest() string

DefaultOrLatest 查找 $PATH 里的 go 或者是最高版本的 go 若没有,也会返回 "go"

func (*SDK) Latest

func (gs *SDK) Latest() string

Latest 返回最新版本的 "go" 的路径,若不存在,会返回空

func (*SDK) LatestOrDefault

func (gs *SDK) LatestOrDefault() string

LatestOrDefault 返回最新版本,或者是 $PATH 里的 go 版本 若没有,也会返回 "go"

func (*SDK) List

func (gs *SDK) List() []string

List 返回当前机器所有安装的,可用的 'go' 的地址 版本由高到低排序 若没有,会返回空

Jump to

Keyboard shortcuts

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