在Windows中构建GO程序

I have found an interesting program in the language of Go. This is the first time I work with this language and I dont know much of it.

Basically it is a network bandwidth speedtest.

The program works verry well, I just would like to modify its output a little. So I have to edit the source and rebuild the project to get the update .exe file.

The wiki of the project says:

Building speedtest

  1. Clone/build speedtest go get github.com/zpeters/speedtest
  2. cd ~/go/bin/code>
  3. ./speedtest

I did step 1. but I don't know what to do with step 2. ? What is it ? What is "~" means and what is "code>" ?

Also is "./" means running a shell script file? I work in Windows. Can somebody please help me to compile this Go program?

E D I T:

The src contains 3 packages:

  • github.com
  • golang.org
  • gopkg.in

How should I compile?

If I try:

go install speedtest

I got

can't load package: package speedtest: cannot find package "speedtest" in any of:

C:\go\src\speedtest (from $GOROOT)

C:\gonetwork\src\speedtest (from $GOPATH)

Your message line:

C:\gonetwork\src\speedtest (from $GOPATH)

suggests that your GOPATH is set to c:\Gonetwork.

Do it like this then, open a command prompt.

c:
cd \GoNetwork\src
go get github.com/zpeters/speedtest

When it completes:

c:\GoNetwork\bin\speedtest.exe

As far as you have been able to execute go get github.com/zpeters/speedtest with no error, you already have your code in your $GOPATH and the binary in $GOBIN, the only thing you need to modify it is go to its location, in your case, according to your output it should be something like:

cd C:\gonetwork\src\speedtest\github.com\zpeters\speedtest

Once you are there, and modified the code to your needs, you only need to run go install github.com/zpeters/speedtest