ubuntu 安裝go語言編譯環境

來源:互聯網
上載者:User
這是一個建立於 的文章,其中的資訊可能已經有所發展或是發生改變。


   1. ubuntu 安裝 go語言

         sudo apt-get install golang

  2.測試go

      mkdir CODE                    //建立一個名為CODE的檔案夾的命令

      vim test.go                           //在vim下建立一個名為test的go檔案的命令

      按i進入插入模式,編輯代碼

/*************************************************************************> File Name: test.go> Author: ACway > Created Time: 2015年01月10日 星期六 15時23分29秒 ************************************************************************/package mainimport "fmt"func main(){fmt.Println("Hello Word!\n");}


    按Esc退出插入模式

    :wq                    //儲存並退出vim命令

    編譯go程式

    go  build  test.go    //編譯test.go程式

    這時再輸入ls命令就可以發現出現了一個名為test的可執行檔,


       輸入“./test"執行這個檔案,就可以出現程式運行結果

    運行go程式

   go run test.go    //運行test.go程式


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.