官术网_书友最值得收藏!

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
主站蜘蛛池模板: 沙洋县| 广河县| 城步| 资中县| 当雄县| 淳化县| 永福县| 松江区| 灵寿县| 博乐市| 洛宁县| 霍州市| 宜川县| 蕲春县| 无锡市| 沁阳市| 青龙| 莱阳市| 永胜县| 舒兰市| 盐津县| 开原市| 新津县| 武川县| 临沂市| 城固县| 红河县| 麻江县| 莫力| 武定县| 禄劝| 二连浩特市| 咸宁市| 乐安县| 梁山县| 松阳县| 寻乌县| 德清县| 肇东市| 博客| 收藏|