Hacker News new | ask | show | jobs
by 0xjnml 37 days ago
> Yeah, it breaks when the author decides to move from Github into Gitlab to protest against Microsoft.

The import path is disconnected from where the build system looks for the files. Of course, the default is to use the import path as an URL, right, but nothing forces you to do that. And if you do, *you* lock yourself to the hosting you use. But that can be hardly blamed on Go.

Documentation here: https://pkg.go.dev/cmd/go#hdr-Remote_import_paths

Full example: https://github.com/rsc/swtch/blob/master/app/rsc-io/main.go

tl;dr: Serve this at your domain, update the repo-root when changing host platform for your code: <meta name="go-import" content="import-prefix vcs repo-root">. No one else has to do anything.

1 comments

I am well aware, as you might find out in my comment history all the way back to Go pre 1.0.

Additional work that is superfluous in other mature programming ecosystems, that don't have the dumb idea to use SCM urls as import paths.