在樹莓派上安裝go環境很簡單

stpeace發表於2017-12-12

       之前在ubuntu上安裝go環境, 居然還去下載包, tar解壓, 設定環境變數, 其實, 完全沒有必要, 一個命令就搞定。 樹莓派也是如此:

sudo apt-get install golang
       寫個程式, 看下結果:

pi@raspberrypi:~/taoge $ cat test.go 
package main  
  
import "fmt"  
  
func main(){  
    fmt.Println("hello world")  
    fmt.Println("This is my first Go code")  
}  
pi@raspberrypi:~/taoge $ 
pi@raspberrypi:~/taoge $ 
pi@raspberrypi:~/taoge $ 
pi@raspberrypi:~/taoge $ go run test.go 
hello world
This is my first Go code
pi@raspberrypi:~/taoge $ 
       sudo halt關樹莓派, 睡覺。




相關文章