This is a creation in Article, where the information may have evolved or changed.
First, attach a go package that compiles to show the progress of the go get:
CENTOS7 Direct Decompression Version Go:http://pan.baidu.com/s/1mik3ci8
Windows7 Direct Decompression Version Go:http://pan.baidu.com/s/1jiaxkee
First, modify the go get progress display before compiling:
Because the Beego on the github.com is a bit big, so go get Github.com/leanote/leanote/app will be very slow, this will execute for a few minutes or longer, do not know the friend still think that the card is dead. Find the next Go get no option to output progress, so decided to modify the Golang source (do not think that there is a technical content, not the go code?).
Read the next Golang source Src/cmd/go is the Go Command source, wherein, GET.GO is the code of the Go Get command, Build.go is the code of Go build.
Just started to go a little detour, thinking about changing get.go to show progress, no results after thinking, go get is actually called Git, HG, svn command downloaded from the warehouse, so the idea to find Vcs.go (VCs all called version control System), sure enough here The polygon contains commands to call Git, Hg, and SVN. Problem solved:
- Modify the git clone command to add the--progress option to make the output progress
- Modify CMD. where run () is executed so that it positions the output on the standard output stream
1. Modify the git clone command to find the following code in Createdcmd modified to clone--progress {repo} {dir}
Other commands Hg, SVN ... Add a progress method similar to
Vcsgit describes how to use Git.var vcsgit = &vcscmd{name: "Git", cmd: " git", Createcmd: "clone {repo} {dir}" ,//Modified here to clone--progress {repo} {dir}downloadcmd: "Pull--ff-only"}
2. redirect the output stream
Locate the Run1 () method in CMD. Stderr = Add two lines under &buf, such as:
var buf bytes. Buffercmd.stdout = &bufcmd. Stderr = &bufcmd. Stdout = OS. Stdout//redirect standard output cmd. Stderr = OS. Stderr//redirect standard output err = cmd. Run ()
Ok, done, next execute Golang source src all.bash recompile golang, compile to some time, after compiling, use go get to try:
Don't worry if you see the progress bar.
Before modifying the Golang source to make its closing variable unused, the package is not used by the error:
Close Golang's variable declared but not used and package imported and not used
Two: Window7 the following compile go:
Copy a Go Source:
Set goroot_bootstrap=c:\go1.7
environment variable setup is required to restart the effective!!!
Download install: Mingw-minimalist GNU for Windows
https://sourceforge.net/projects/mingw/
You can also download TDM-GCC MinGW Compiler directly
Add to Path:
Set path=.; C:\TDM-GCC-64\bin\
Three: Centos7 the following compile go:
Linux Similarly, execute the compile script for the SH all.bash under SRC
After compiling, execute go get: