Files
the-way-to-go_ZH_CN/eBook/03.4.md
2013-04-18 22:02:22 -04:00

16 lines
979 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#3.4 构建并运行 Go 程序
***译者注:由于 Go 语言版本更替,本节中的相关内容经原作者同意将被直接替换而不作另外说明***
在大多数 IDE 中,每次构建程序之前都会自动调用源码格式化工具 `gofmt` 并保存格式化后的源文件。如果构建成功则不会输出任何信息,而当发生编译时错误时,则会指明源码中具体第几行出现了什么错误,如:`a declared and not used`。一般情况下,你可以双击 IDE 中的错误信息直接跳转到发生错误的那一行。
如果程序执行一切顺利并成功退出后,将会在控制台输出 `Program exited with code 0`
从 Go 1 版本开始,使用 Go 自带的更加方便的工具来构建应用程序:
- `go build` 编译并安装自身包和依赖包
- `go install` 安装自身包和依赖包
##链接
- [目录](directory.md)
- 上一节:[调试器](03.3.md)
- 下一节:[格式化代码](03.5.md)