上QQ阅读APP看书,第一时间看更新
Building the executable file
To compile and build an executable file, use the go build command. When running go build you must pass a path to a package. The package path you provide is relative to $GOPATH/src. Since our package is in ~/src/hello, we would run the command as follows:
go build hello
We can actually call go build from anywhere as long as we have a $GOPATH set. The executable binary that is created will be output in the current working directory. You can then run it with this command:
./hello