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

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
主站蜘蛛池模板: 斗六市| 睢宁县| 扎囊县| 浦北县| 唐海县| 思南县| 阿坝县| 平乐县| 奉新县| 甘泉县| 汶川县| 镇江市| 三江| 安仁县| 泾阳县| 长沙市| 获嘉县| 利辛县| 时尚| 綦江县| 左权县| 松滋市| 五峰| 怀宁县| 阜城县| 上林县| 体育| 勃利县| 武邑县| 桦甸市| 平潭县| 岳西县| 秦皇岛市| 德兴市| 晋江市| 常山县| 信宜市| 巢湖市| 临江市| 青海省| 登封市|