go set up on ubuntu

sudo apt-get install golang-go 


package main
 
    import (
        "fmt"
         "runtime"
    )

    func main() {
        fmt.Println("Hellow World!", runtime.Version())
    }    
复制代码

执行go run helloWorld.go, 应该会打印出:

或者go build helloWorld.go,将生成helloWorld.sh,./helloWorld也可以运行。

原文地址:https://www.cnblogs.com/rebot/p/7573879.html