- Go Systems Programming
- Mihalis Tsoukalos
- 262字
- 2021-07-02 18:07:55
Getting ready for Go
You can easily find your version of Go using this command:
$ go version go version go1.7.5 darwin/amd64
The previous output is from a macOS machine hence the darwin string. A Linux machine would give the following kind of output:
$ go version go version go1.3.3 linux/amd64
You will learn more about go tool, which you will use all the time, in the next chapters.
As I can imagine, you must be impatient to see some Go code; so here is the Go version of the famous Hello World program:
package main import "fmt" // This is a demonstrative comment! func main() { fmt.Println("Hello World!") }
If you are familiar with C or C++, you will find Go code pretty easy to understand. Each file that contains Go code begins with a package declaration followed by the needed import declarations. The package declaration shows the package that this file belongs to. Note that semicolons are not required for successfully terminating a Go statement unless you want to put two or more Go statements in the same line.
In Chapter 2, Writing Programs in Go, you will find out how to compile and execute Go code. For now, it is enough to remember that Go source files are stored using the .go file extension: your task is to choose a descriptive filename.
- C#完全自學教程
- ASP.NET Core 2 and Vue.js
- Visual Basic程序設計習題解答與上機指導
- Microsoft Dynamics GP 2013 Reporting, Second Edition
- Jenkins Continuous Integration Cookbook(Second Edition)
- PHP從入門到精通(第4版)(軟件開發視頻大講堂)
- Scala Data Analysis Cookbook
- ASP.NET程序開發范例寶典
- Citrix XenServer企業運維實戰
- Python:Deeper Insights into Machine Learning
- Orleans:構建高性能分布式Actor服務
- Android Development Tools for Eclipse
- 零基礎學HTML+CSS
- 數據分析與挖掘算法:Python實戰
- Raspberry Pi開發實戰