Gogland使用 - 非常簡單查看Go語言原始碼全貌!

來源:互聯網
上載者:User

標籤:快速鍵   dev   ati   lan   菜單   ring   write   tin   查看   

Go語言也支援物件導向開發,不過和以往我們所使用的物件導向開發還是有不同,Go語言主張組合方式形成類的概念,在Go語言中,結構起到很大作用,如果用結構組合欄位和方法,那麼單純在原始碼中看,真的是費時費力,尤其看別人寫的代碼,舉例如下:

type rawConnection struct {id       DeviceIDname     stringreceiver Modelcr *countingReadercw *countingWriterawaiting    map[int32]chan asyncResultawaitingMut sync.MutexidxMut sync.Mutex // ensures serialization of Index callsnextID    int32nextIDMut sync.Mutexoutbox      chan asyncMessageclosed      chan struct{}once        sync.Oncepool        bufferPoolcompression Compression}

這個rawConnection是一個結構,同時它也定義了很多方法,如果僅僅在原始碼裡面查看,真的讓你暈頭轉向,我剛才看rawConnection時候,看了半天,也沒能完整瞭解它,但是,當我開啟Gogland的“Structure”時候,真的不得不表揚Gogland,做得太棒了,立即完整展現了rawConnection,包括它所有的欄位和方法,讓我能夠快速完整瞭解rawConnection!!Gogland預設情況下,“Structure”好像並沒有開啟,如果沒有開啟,我們可以點擊頂部菜單開啟:“View”->"Tools Windows"->"Structure",也可以通過快速鍵“Alt+7”開啟。

通過“Structure”查看rawConnection的整體結構,這個結構的全貌一覽無遺,太棒了!!

 

Gogland使用 - 非常簡單查看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.