go.mod 中的模块名称别名

Module name alias in go.mod

有没有办法在模块中使用更短的名称representation/mapping?

我有一个项目,url 命名:

module github.com/<org>/<project>    
go 1.14

能做到就好了:

import "<short_name>/<project>/package_folder"

来自 go.mod,类似于:

module github.com/<org>/<project> => short_name
go 1.14

不,无法在 go.mod 文件中定义别名。

proposed but rejected for reasons explained here

我最近 运行 使用一个命名不当的内部存储库来解决这个问题。 Go 不会这样做,但是使用一些 git 魔法你可以接近。

在您的 ~/.gitconfig 中添加如下内容: [url "ssh://git@github.com//"] insteadOf = https://github.com//