1. 程式人生 > >Golang的第一個程式-Hello, World !

Golang的第一個程式-Hello, World !

安裝Golang:

1. 下載安裝包

https://golang.google.cn/dl/

我這裡使用壓縮包,下載後解壓到D盤(自定義)。

2. 新增環境變數:把解壓後的bin目錄新增到環境變數中

 

第一個程式:

1. 新建一個test.go檔案,編寫如下內容:

package main

import "fmt"

func main() {
    fmt.Println("Hello, World!")
}

2. 進入 cmd 執行 go run test.go ,就會輸出:

Hello, World!

 

到此,Golang的第一個程式就完成了!