- 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.
- Mastering Zabbix(Second Edition)
- Windows Forensics Cookbook
- Learning Python by Building Games
- 劍指大數(shù)據(jù):企業(yè)級(jí)數(shù)據(jù)倉(cāng)庫(kù)項(xiàng)目實(shí)戰(zhàn)(在線教育版)
- Flowable流程引擎實(shí)戰(zhàn)
- 從零開(kāi)始學(xué)Python網(wǎng)絡(luò)爬蟲(chóng)
- STM8實(shí)戰(zhàn)
- Drupal 8 Development:Beginner's Guide(Second Edition)
- Python機(jī)器學(xué)習(xí)
- 數(shù)據(jù)庫(kù)技術(shù)及應(yīng)用教程上機(jī)指導(dǎo)與習(xí)題(第2版)
- Illustrator CS6中文版應(yīng)用教程(第二版)
- Ionic Framework By Example
- Salt Cookbook
- Python實(shí)現(xiàn)Web UI自動(dòng)化測(cè)試實(shí)戰(zhàn):Selenium 3/4+unittest/Pytest+GitLab+Jenkins
- Hands/On Microsoft Teams