eddycjy / blog

煎鱼的博客,有点忙,传送门:https://eddycjy.com
3.05k stars 429 forks source link

使用go 1.18,在连载二中 添加 go.mod replace之后 出现错误 求教 #162

Closed xihongshi153 closed 2 years ago

xihongshi153 commented 2 years ago

[root@ecs-350208 go-gin-example]# go get -u github.com/go-ini/ini go: errors parsing go.mod: /root/go/gopath/src/go-gin-example/go.mod:26:3: replacement module without version must be directory path (rooted or starting with ./ or ../) /root/go/gopath/src/go-gin-example/go.mod:27:3: replacement module without version must be directory path (rooted or starting with ./ or ../) /root/go/gopath/src/go-gin-example/go.mod:28:3: replacement module without version must be directory path (rooted or starting with ./ or ../) /root/go/gopath/src/go-gin-example/go.mod:29:3: replacement module without version must be directory path (rooted or starting with ./ or ../) /root/go/gopath/src/go-gin-example/go.mod:30:3: replacement module without version must be directory path (rooted or starting with ./ or ../)

xihongshi153 commented 2 years ago

已解决 替换为全路径即可 replace ( github.com/EDDYCJY/go-gin-example/conf => /root/go-application/go-gin-example/pkg/conf github.com/EDDYCJY/go-gin-example/middleware => /root/go-application/go-gin-example/middleware github.com/EDDYCJY/go-gin-example/models => /root/go-application/go-gin-example/models github.com/EDDYCJY/go-gin-example/pkg/setting => /root/go-application/go-gin-example/pkg/setting github.com/EDDYCJY/go-gin-example/routers => /root/go-application/go-gin-example/routers )

wuzhiqiao commented 1 year ago

感谢,我也遇到了这个问题

jincheng9 commented 1 year ago

可以参考这个教程:https://github.com/jincheng9/go-tutorial/tree/main/workspace/lesson27