go語言環境搭建(基於go1.8)

來源:互聯網
上載者:User
  • Linux(centos redhat ) 安裝
    1.訪問官方地址:
    https://golang.org/dl/
    由於相關ZC你懂的,最好能翻牆下
    2.下載64位綠色包:
    https://storage.googleapis.com/golang/go1.8.3.linux-amd64.tar.gz
    3.下載完畢後:
    假定你想要安裝Go的目錄為$GO_INSTALL_DIR,後面替換為相應的目錄路徑。
    解壓縮tar.gz包到安裝目錄下:
tar -xvf go1.8.3.linux-amd64.tar.gz -C $GO_INSTALL_DIR

4.添加環境變數vim /etc/profile,加入如下幾行

export PATH=$PATH:$GO_INSTALL_DIR/go/binexport GOROOT= $GO_INSTALL_DIR/goexport GOBIN=$GOROOT/binexport GOPATH= $GO_INSTALL_DIR/go/data  注意 $GO_INSTALL_DIR 為你的go的安裝或者解壓目錄
  • 然後執行go
[root@centos ~] goGo is a tool for managing Go source code.Usage:    go command [arguments]The commands are:    build       compile packages and dependencies    clean       remove object files    doc         show documentation for package or symbol    env         print Go environment information    bug         start a bug report    fix         run go tool fix on packages    fmt         run gofmt on package sources    generate    generate Go files by processing source    get         download and install packages and dependencies    install     compile and install packages and dependencies    list        list packages    run         compile and run Go program    test        test packages    tool        run specified go tool    version     print Go version    vet         run go tool vet on packagesUse "go help [command]" for more information about a command.Additional help topics:    c           calling between Go and C    buildmode   description of build modes    filetype    file types    gopath      GOPATH environment variable    environment environment variables    importpath  import path syntax    packages    description of package lists    testflag    description of testing flags    testfunc    description of testing functionsUse "go help [topic]" for more information about that topic.

看到以上資訊,說明go環境已經搭建起來

  • 查看go的版本
[root@centos ~] go versiongo version go1.8 linux/amd64
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.