Reputation: 25934
Is there a way to use a shorter name representation/mapping in modules?
I have a project, with an url naming:
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:
module github.com/<org>/<project> => short_name
go 1.14
Upvotes: 8
Views: 9756
Reputation: 21
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.
In your ~/.gitconfig add something like this: [url "ssh://[email protected]//"] insteadOf = https://github.com/<go_mod_org>/<go_mod_repo>
Upvotes: 2