显示go get的进度
目录
修改源代码
打开$GOROOT/src/cmd/go/vcs.go
,修改以下两处
- 增加
--progress
// vcsGit describes how to use Git.
var vcsGit = &vcsCmd{
name: "Git",
cmd: "git",
createCmd: []string{"clone --progress {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"},
downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
...
}
- 重定向输出
// run1 is the generalized implementation of run and runOutput.
func (v *vcsCmd) run1(dir string, cmdline string, keyval []string, verbose bool) ([]byte, error) {
...
var buf bytes.Buffer
cmd.Stdout = &buf
cmd.Stderr = &buf
cmd.Stdout = os.Stdout // 新增
cmd.Stderr = os.Stderr // 新增
err = cmd.Run()
out := buf.Bytes()
...
}
重新编译
- 下载go1.4,解压到
C:\Users\username\go1.4
- 下载gcc,配置环境变量
-
LIBRARY_PATH = C:\MinGW\lib
-
C_INCLUDE_PATH = C:\MinGW\include
-
Path中添加C:\MinGW\bin
-
运行$GOROOT/src/all.bash
重新编译即可