I definitely fork things and use "replace" quite frequently.

When forking something you have to tell Go where to find it, that's
what "replace" is for.

There's a issue about using replaces in `go install` without a go.mod:

https://github.com/golang/go/issues/44840

On Sun, Dec 4, 2022 at 11:40 PM Volker Dobler
<dr.volker.dob...@gmail.com> wrote:
>
> On Sunday, 4 December 2022 at 15:13:46 UTC+1 ren...@ix.netcom.com wrote:
>>
>> Can’t you use a replace directive to use the fork ?
>
>
> No, not in the general case.
>
> V.
>
>>
>>
>> On Dec 4, 2022, at 6:17 AM, Volker Dobler <dr.volke...@gmail.com> wrote:
>>
>> You cannot use a "fork". The Github concept of a "fork" doesn't
>>
>> work together with the concept of a Go module.
>> You are free to fork a repo and you can modify the source
>> after git cloning your "fork" you even can build the "fork" and
>> go install it's binaries by simply running go install inside
>> of the "fork". But your "fork" just remains a Github-fork,
>> it's not a software fork of the original module. For that you
>> have to rename it. Forks in Go cannot (for reasonable definition
>> of cannot) have the the same name as the original.
>>
>> V.
>>
>> On Saturday, 3 December 2022 at 12:55:08 UTC+1 dun...@harris3.org wrote:
>>>
>>> This seems a noddy question but can't easily find an answer with Google 
>>> apparently. I may have lost the plot :-)
>>>
>>> There is a repo which contains source for a go executable that I want to 
>>> use.
>>> Normally I install this with: go install original.domain/path@latest
>>> I want to fork that repo and make some experimental changes.
>>> So then I want to: go install my.forked.domain/path@commit
>>> But if I don't also change the go.mod file in my fork I get something like:
>>>
>>> go: downloading my.forked.domain/path v0.0.0-20221203102529-commit
>>> go: my.forked.domain/path@commit: 
>>> my.forked.domain/pa...@v0.0.0-20221203102529-commit: parsing go.mod:
>>>     module declares its path as: original.domain/path
>>>             but was required as: my.forked.domain/path
>>>
>>> Obviously I could change the go.mod in my fork, but that seems wrong if I 
>>> later want to submit a PR on the original repo.
>>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to golang-nuts...@googlegroups.com.
>>
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/golang-nuts/50ed3b47-75e6-4e4c-b06f-1da5351481e7n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/2d404195-2a47-47e9-98f8-273e8159426fn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CA%2Bh8R2obg1OoTVMhyZ%2Bj1wOzKd0uLekAm4Gr3SgfCLSW6C6%2BvA%40mail.gmail.com.

Reply via email to