1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        10+ 條 Go 官方諺語,你知道幾條?

        共 1446字,需瀏覽 3分鐘

         ·

        2022-05-23 18:12

        作為一個 Go 語言開發(fā)工程師,總是在入門、深入、撕提案時能夠聽到各種帶有 Go 特色的話語,例如:少即是多(less is more),非常有趣。

        今天帶來了 Go 語言之父 Rob Pike 在 2015 年分享的主題《Go Proverbs》,它在該主題中講了的 10+ 條 Go 諺語,希望大家可以用上。

        核心理念是:簡單、詩意、簡潔(Simple, Poetic, Pithy)。

        • 諺語
        1. 不要通過共享內(nèi)存來通信,通過通信來共享內(nèi)存(Don't communicate by sharing memory, share memory by communicating)。

        2. 并發(fā)不是并行(Concurrency is not parallelism)。

        3. 通道是協(xié)調(diào)的,互斥是串行的(Channels orchestrate; mutexes serialize)。

        4. 接口越大,抽象性越弱(The bigger the interface, the weaker the abstraction)。

        5. 讓零值變得有用(Make the zero value useful)。

        6. interface{} 什么也沒說(interface{} says nothing)。

        7. Gofmt 的風格沒有人喜歡,但 Gofmt 卻是大家的最愛(Gofmt's style is

          no one's favorite, yet gofmt is everyone's favorite)。

        8. 復制一點總比依賴一點好(A little copying is better than a little dependency)。

        9. Syscall 必須始終用 build 標簽來保護(Syscall must always be guarded with build tags)。

        10. Cgo 必須始終用構(gòu)建標簽來保護(Cgo must always be guarded with build tags)。

        11. Cgo 不是 Go(Cgo is not Go)。

        12. 使用 unsafe 包沒有任何保證(With the unsafe package there are no guarantees)。

        13. 清晰的比聰明的好(Clear is better than clever)。

        14. 反射從來不是清晰的(Reflection is never clear)。

        15. 錯誤就是價值(Errors are values)。

        16. 不要只是檢查錯誤,要優(yōu)雅地處理它們(Don't just check errors, handle them gracefully)。

        17. 設計架構(gòu),命名組件,記錄細節(jié)(Design the architecture, name the components, document the details)。

        18. 文檔是為用戶準備的(Documentation is for users)。

        19. 不要使用恐慌(Don't panic)。

        • 總結(jié)
        Rob Pike 在演講中所涉及到的這 18 條諺語,是他常年在計算機軟件領(lǐng)域開發(fā)和設計 Go 時所積累下來的經(jīng)驗。(希望能夠?qū)δ阌兴鶐椭?/span>


        END



        -猜你想看-微軟開源的支持多平臺多協(xié)議的網(wǎng)絡性能檢測工具 Ethrvscode 調(diào)試技巧|程序不是寫出來的?是調(diào)出來的!


        想要了解Go更多內(nèi)容,歡迎掃描下方???關(guān)注?公眾號,回復關(guān)鍵詞 [實戰(zhàn)群]? ,就有機會進群和我們進行交流~


        分享、在看與點贊,至少我要擁有一個叭~

        6cde5eb763adad4229792fef6a9c13d6.webpd5de19aeda87dd44c92df1ffbafab03e.webp
        瀏覽 56
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            色秘 乱码一区二区三区18 | 国产啪在线 | 4438成人网站 | 国产精品视频看看 | 午夜高清无码 | 一呦二呦三呦国产精品 | 97人伦影院A片在线观看97 | 骚逼久久| 26uuu最新亚洲片区 | 喷水久久 |