[英]Module name alias in go.mod
Is there a way to use a shorter name representation/mapping in modules?有没有办法在模块中使用更短的名称表示/映射?
I have a project, with an url naming:我有一个项目,命名为 url:
module github.com/<org>/<project>
go 1.14
Would be nice to be able to do:能够做到这一点会很高兴:
import "<short_name>/<project>/package_folder"
From a go.mod
, something like:从go.mod
,类似于:
module github.com/<org>/<project> => short_name
go 1.14
I've run into this recently with a poorly named internal repo.我最近遇到了一个命名不佳的内部回购协议。 Go doesn't do this, but with some git magic you can get close. Go 不这样做,但是通过一些 git 魔法,您可以接近。
In your ~/.gitconfig add something like this: [url "ssh://git@github.com//"] insteadOf = https://github.com/ <go_mod_org>/<go_mod_repo>在你的 ~/.gitconfig 添加如下内容: [url "ssh://git@github.com//"] insteadOf = https://github.com/ <go_mod_org>/<go_mod_repo>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.