TLDR
> Is it possible to fork a repo and change the import path of the repository?
Not in one step with the github “click to fork”. You need to do one of the following:
1. Create a new empty remote repo, remap imports, and push to the new remote.
2. Fork, update imports, push.
3. Assuming vanity URL is used, fork and then update the vanity urls meta tag.
> Is it possible to have:
> both repos
yes but I would try to deprecate one as “archived/historical”.
> every repo with it's own import path
yes, it does by nature of being different urls
> code exchange between them
yes, but I’d avoid if possible. You’ll need to remap imports to match the repo so it’s not a simple push to both remotes.
—
You can use gofmt to remap the import paths. If you’re aim is to “sync” repos (I’m not clear why you’d want this aside from a clearance process for making corp stuff public) then you could encode the commands in a script or make target and trigger them as part of a “publishing process”. Relative import paths were available at one point but they are now deprecated/unavailable. In theory it allowed ignorance of the SCMs root at the sacrifice of not being go gettable and probably a number of other issues which resulted in its removal.
Godoc isn’t essential infrastructure in my opinion, you can serve docs locally in a pinch and I often do this while working offline in planes, trains, and automobiles. Introducing a registry however adds a failure domain/security concern that can break or be compromised. If githubs down and your repo is on github it’s the same failure domain so you’re arguably no worse/better off if your deps are there. Committing vendor where possible minimises the failure domains further and generally yields faster CI builds as a side benefit IME.
Another option might be abusing vanity urls if the objective is to support ongoing development in both repos (eg returning different meta tags based on a work IP vs not or a local /etc/hosts override to a different vanity url host). I’m not terribly familiar with them but in theory it should allow the same import path in both repos but it would likely result in some confusing issues. I don’t think it’s a great idea but it might work for your scenario.
--