Why we should use a URL for the Go module name?
There are two benefits to this particular naming style.
Globally unique names
The first benefit is the same as why Java uses a similar convention for package names: If (the beginning of) your package name is a registered domain name that is under your control, then you can guarantee that your package name will be unique, without the Go community having to run their own global distributed package registry database – the ICANN already does that for you.
Location, Location, Location
The go get
command knows how to automatically download packages whose name looks like a partial URI, using only the name. Again, this means that the Go community does not have to run their own package repository (like e.g. the NPM registry, RubyGems.Org, PyPI, CPAN, CTAN, etc.) but they can just let "the web" be the package registry.
This allows the package name to not only be a unique identifier but also a locator, at the same time. In other words, instead of maintaining three different things, a name, an ID, and locator, you only need the name.
This is similar to how ECMAScript modules are also referred to by URIs in web scripts, or how Deno uses URIs in module names for TypeScript.