go-linux环境搭建

 

下载 go1.11.linux-amd64.tar.gz
解压: tar zxvf  go1.11.linux-amd64.tar.gz -C /usr/local


配置环境变量:vim  /root/.bashrc
export GOROOT=/usr/local/go
export GOPATH=/usr/local/goWSpace/golib:/usr/local/goWSpace/goprj
export GOBIN=/usr/local/goWSpace/gobin
export PATH=$PATH:$GOROOT/bin:$GOBIN
source /root/.bashrc

 

main.go

package main

import "fmt"

func main() {
        fmt.Printf("hello, world\n")
}

 

go build main.go

 

posted @ 2019-02-13 21:24  osbreak  阅读(246)  评论(0编辑  收藏  举报