by leaveyou · 2y ago · 0 comments
go mod init example.com/hello
and also hardcoded in all the import statements
import "example.com/hello"
what if you move the code to other domain ? you need to change the module and all the references to it instead of only the references
I find it quite cumbersome/counter intuitive even after all these years.
It is bad enough how much of a monopoly and tie-in github today has (probably the reason Microsoft bought it) and a language environment shouldn't contribute or even aplify that role.
Further discussion: https://stackoverflow.com/questions/40288843/installing-npm-...
It's just that most people don't do that, same as how most people will just store their code in GitHub.
<meta name="go-import" content="root-path vcs repo-url">How exactly? If e.g. the registrar seizes the domain name that I've originally used and gives it to someone else, what, exactly, are my plans supposed to be for that?
Creating a central authority for names is a lot of work.
Im not that experienced with Go, but I believe it's possible to create a vanity package name on a domain you control. If you want to change hosts, you can just point your domain to something else.
I may be wrong there though!
The go-import tag is documented here: https://go.dev/ref/mod#vcs-find
It's a bit more fiddly if your module is part of a monorepo and doesn't live at the root. In that case your go-import tag needs to point to a GOPROXY server. I have a proxy server here: https://github.com/more-please/more-stuff/tree/main/gosub
https://pkg.go.dev/cmd/go#hdr-Remote_import_paths
Also AFAIK there's still no good UX for private packages that require auth.
If you want to move to another domain the “go mod edit —replace” cli tool is designed for this.
If you want to host somewhere else, or maybe change to a vanity url or something, you can just publish a go-import meta tag and it all just works https://pkg.go.dev/cmd/go#hdr-Remote_import_paths
I don’t write go myself but man did they get a lot of big decisions right. I’d be totally open to writing go in future but I have java so don’t really need it. I envy go’s build and deploy stories though.
'ShinyModule' https://github.com/shinyAuthor/ShinyModule or
'ShinyModule' ../../ShinyModule or
'ShinyModule' \\something\something\ShinyModule
and if there is no 'download' description for an import, the default should be ..\ShinyModule relative to the current/importing module
It's not because the tooling is better, which also happens to be true by far, but because they didn't tie themselves down to a domain name scheme. Funny, given that go waited a long time to take a shot.
It's the part of Go I find the weirdest
Node/Npn does this best.