Skip to content

Commit

Permalink
Modify doc: 修订README
Browse files Browse the repository at this point in the history
  • Loading branch information
voidint committed May 7, 2019
1 parent cbaac84 commit 5808b37
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# g
`g`是一个命令行工具,可以提供一个便捷的多版本go环境的管理和切换。
[![GoDoc](https://godoc.org/github.com/voidint/g?status.svg)](https://godoc.org/github.com/voidint/g)
[![Go Report Card](https://goreportcard.com/badge/github.com/voidint/g)](https://goreportcard.com/report/github.com/voidint/g)

`g`是一个命令行工具,可以提供一个便捷的多版本[go](https://golang.org/)环境的管理和切换。


## 特性
- 支持列出可供安装的go版本号
Expand All @@ -9,17 +13,21 @@
- 支持在已安装的go版本之间自由切换

## 安装
### 自动化安装
敬请期待

### 手动安装
- 下载对应平台的二进制压缩包。
- 将压缩包解压至`PATH`环境变量目录下,如`/usr/local/bin`
- 编辑shell环境配置文件(`~/.bashrc``~/.zshrc`...)

```shell
cat > ~/.bashrc <<EOF
$ cat > ~/.bashrc <<EOF
export GOROOT=~/.g/go
export PATH=$GOROOT/bin:$PATH
export PATH=~/.g/go/bin:$PATH
export G_MIRROR=https://golang.google.cn/dl/
unalias g
EOF
$ source ~/.bashrc
```
## 使用
Expand Down Expand Up @@ -93,6 +101,18 @@ go version go1.12.4 darwin/amd64
g uninstall 1.11.9
Uninstall successfully
```
## FAQ
- 环境变量`G_MIRROR`有什么作用?
由于中国大陆无法自由访问Golang官网,导致查询及下载go版本都变得困难,因此可以通过该环境变量指定一个镜像站点(如`https://golang.google.cn/dl/`),g将从该站点查询、下载可用的go版本。
- 支持源代码编译安装吗?
不支持
- 支持Linux、macOS、Windows下使用吗?
暂未支持Windows。
## 鸣谢
感谢[nvm](https://github.com/nvm-sh/nvm)、[n](https://github.com/tj/n)、[rvm](https://github.com/rvm/rvm)等工具提供的思路
感谢[nvm](https://github.com/nvm-sh/nvm)、[n](https://github.com/tj/n)、[rvm](https://github.com/rvm/rvm)等工具提供的宝贵思路

0 comments on commit 5808b37

Please sign in to comment.