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文件中
<span style="color:#f33b45;"> 请注意module 对应的名称是github的地址,而不是项目名称</span>
Go模块中规范了一个重要原则
<em>If an old package and a new package have the same import path, the new package must be backwards compatible with the old package.</em>3
<pre><code>如果旧包和新包具有相同的导入路径,新包必须向后兼容旧包。</code></pre>小广告系列:
本人热衷于技术,希望提供些许轮子,提升效和提质。
仓库地址:https://github.com/codefocus-club/
到此这篇关于“golang 利用github自定义module 踩坑系列 类似于「springboot starter 一毛一样」”的文章就介绍到这了,更多文章或继续浏览下面的相关文章,希望大家以后多多支持JQ教程网!
您可能感兴趣的文章:
golang 利用github自定义module 踩坑系列 类似于「springboot starter 一毛一样」
springboot和mybatis两个框架结合教程
Go Modules 和 Go Proxy
Springboot 系列(二)Spring Boot 配置文件全解析
五分钟学会使用 go modules
Go Modules笔记
go 包管理 踩坑
golang 踩坑
Go Modules与GOPROXY 配置
使用 GitHub Actions 自动化构建 Golang 应用