Does module name has to start with a valid domain name?

145 views
Skip to first unread message

isu...@gmail.com

unread,
Aug 5, 2019, 3:33:22 PM8/5/19
to golang-nuts
Hi, 
We are using bazel to manage dependency and would like to migrate to modules and use JFrog's module proxy. We have many private modules, starts with a name like "foo", and we specify the internal git repo in bazel. Based on the understanding of module proxy protocol, as long as the proxy response to GET requests like GET $GOPROXY/foo/@v/, it should work. The first part of the module name does not have to a domain name. However, when we try it, we do see error message complaining the missing dot in the first section. We looked into the source code module.go and there is a CheckPath function to make sure the first section looks like a domain name. Is it really required? I hope to hear opinions from Go team. Is the check going to be there forever? Or it may be removed in the future? 

Thanks,
Shizheng

Ian Lance Taylor

unread,
Aug 5, 2019, 7:05:07 PM8/5/19
to isu...@gmail.com, golang-nuts
On Mon, Aug 5, 2019 at 12:33 PM <isu...@gmail.com> wrote:
>
> We are using bazel to manage dependency and would like to migrate to modules and use JFrog's module proxy. We have many private modules, starts with a name like "foo", and we specify the internal git repo in bazel. Based on the understanding of module proxy protocol, as long as the proxy response to GET requests like GET $GOPROXY/foo/@v/, it should work. The first part of the module name does not have to a domain name. However, when we try it, we do see error message complaining the missing dot in the first section. We looked into the source code module.go and there is a CheckPath function to make sure the first section looks like a domain name. Is it really required? I hope to hear opinions from Go team. Is the check going to be there forever? Or it may be removed in the future?

It doesn't have to be a valid domain name but I believe that it does
have to contain a dot. Names without a dot are in effect reserved for
the Go standard library.

Ian

SZ Li

unread,
Aug 5, 2019, 9:07:20 PM8/5/19
to Ian Lance Taylor, golang-nuts
I see. Makes sense. 

Thanks,
Shizheng

isu...@gmail.com

unread,
Aug 5, 2019, 10:04:56 PM8/5/19
to golang-nuts
Actually, one more thought. If we require to contain a dot, should we apply this check to the module name appears on the first line of the go.mod file? Currently I think the check is applied to the modules listed in "require" list, that means, I can define a module "foo", but not able to refer to it. So perhaps I shouldn't be allowed to define module foo at the first place. 

Thanks,
Shizheng
Reply all
Reply to author
Forward
0 new messages