Closed bigwhite closed 2 years ago
主要设计是为了代码目录简洁,缺点是引用多一个路径~
目前要两个都满足有点难,所以才增加了src目录~ 回头看看如何更好优化,感谢意见!
去掉后(+改一下go.mod),对用户来说使用起来更方便。否则,你的示例程序都无法编译通过。
$go mod tidy
go: finding module for package github.com/heiyeluren/xmm/src
go: downloading github.com/heiyeluren/xmm v0.1.1
go: found github.com/heiyeluren/xmm/src in github.com/heiyeluren/xmm v0.1.1
go: demo imports
github.com/heiyeluren/xmm/src: github.com/heiyeluren/xmm@v0.1.1: parsing go.mod:
module declares its path as: xmm
but was required as: github.com/heiyeluren/xmm
我fork了一份,改了一下目录结构与go.mod,完美编译你的示例程序。 https://github.com/bigwhite/XMM, 需要pr的话,at 我。
感谢意见~ 目前已经修改了 go.mod 还有去掉了src目录~ 后面操作建议是: import( xmm "github.com/heiyeluren/xmm" ) 最后xmm要小写哦~
然后可以: go get github.com/heiyeluren/xmm
就可以在你程序里顺利使用 XMM 啦~ 感谢
👍
建议直接将src下面的源码,拿到项目根目录下,这样包的导入路径最后一个分段与module名/包名一致。
另外go.mod中module path改为github.com/heiyeluren/xmm,方便用户go get。