golang 利用github自定義module 踩坑系列 類似於「springboot starter 一毛一樣」

背景:

    本人java出身,轉行golang,有點類似於springboot starter 。當然好處就不多介紹了,你懂得

目標:

     自定義module,開源公共代碼庫。

工程結構:

          

          

          默認創建golib-config-center-client項目之後的樣子

  遇到的問題:

          

         module declares its path as: 模塊將其路徑聲明爲:
         but was required as:但被要求:

  百度各種解決辦法(依然不好使):

         1.使用replace 替代 這是一種

         2.什麼設置環境變量

         3.什麼ideal工具問題

   解決方法:

      各種閱讀資料、排查、發現問題出在go.mod文件中

       

       請注意module 對應的名稱是github的地址,而不是項目名稱

Go語言模塊管理使用學習記錄

Go模塊中規範了一個重要原則

If an old package and a new package have the same import path, the new package must be backwards compatible with the old package.3

如果舊包和新包具有相同的導入路徑,新包必須向後兼容舊包。

小廣告系列:

    本人熱衷於技術,希望提供些許輪子,提升效和提質。

    倉庫地址:https://github.com/codefocus-club/ 

   

         

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章