go - go.mod 中的模块名称别名

标签 go go-modules

有没有办法在模块中使用更短的名称表示/映射?

我有一个项目,带有一个 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 但由于 here 解释的原因而被拒绝。

关于go - go.mod 中的模块名称别名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61405061/

相关文章:

docker cli swarm 包导入问题

memory - 声明非常大的数组并迭代 stdin 时内存持续增加

Goroutines channel 和 "stopping short"

go - Visual Studio 可以调试 Go 插件吗?

ssl - Artifactory jfrog cli 无法进行身份验证

git - Go mod 用私有(private) fork 替换依赖

go - 如何自动将依赖包添加到 go.mod

go - golang map 未添加元素

go - 如何修复 gomod : `github.com/stretchrcom/testify@v1.4.0: parsing go.mod: unexpected module path "github. com/strethr/testify"`

go - 模块声明为 X 但要求为 Y