Skip to content

Instantly share code, notes, and snippets.

@M2shad0w
Forked from Jimmy-Xu/go-get-progress.md
Created July 28, 2017 14:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save M2shad0w/03662abcbfda26e72792aeafe90879b5 to your computer and use it in GitHub Desktop.
Save M2shad0w/03662abcbfda26e72792aeafe90879b5 to your computer and use it in GitHub Desktop.
go get支持显示进度条

修改 $GOROOT/src/cmd/go/vcs.go,作如下修改

// 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"},

。。。
        var buf bytes.Buffer
        cmd.Stdout = &buf
        cmd.Stderr = &buf
        cmd.Stdout = os.Stdout
        cmd.Stderr = os.Stderr
        err = cmd.Run()

重新编译golang源码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment