Thank you very much!  I have no idea why I thought I needed to change 
go.mod.
I did run into some strange effects changing my local version back to 
"sclevine" though - I also needed to remove the cached versions in *go/pkg*. 
Thanks again!

Brad 

On Sunday, 26 July 2020 at 13:03:22 UTC+12 Denis Cheremisov wrote:

> As soon as I understand you can just keep their module name in `go.mod` 
> and that's it.
>
> воскресенье, 26 июля 2020 г. в 03:46:15 UTC+3, brad.be...@gmail.com: 
>
>> Hi folks.  I was unable to find a good answer online already.  The 
>> closest I found was 
>> https://stackoverflow.com/questions/14323872/using-forked-package-import-in-go
>>  which 
>> suggests using the replace directive in go.mod.
>>
>> I am using Go 1.14, with all projects located outside of GOPATH.
>>
>> My exact situation:  I've forked https://github.com/sclevine/agouti to 
>> https://github.com/Bradbev/agouti.  Originally I renamed all instances 
>> of "sclevine" to "Bradbev" - this works, but doesn't feel right.  
>> Presumably future PR's will be a hassle due to the import changes.
>> I'm trying to fix it locally before pushing up.  So, what I have locally 
>> is
>> 1) A new module agout_test, which contains "replace 
>> github.com/bradbev/agouti => ../agouti" in go.mod so that my test 
>> project references a local copy
>> 2) A local copy of bradbev/agouti at ../agouti.
>>
>> Without changes (ie, import paths ARE rewritten), this works.  When I 
>> change my local agouti imports back to "sclevine", and add "replace 
>> github.com/sclevine/agouti => github.com/bradbev/agouti" to 
>> ../agouti/go.mod, my test complains with:
>>
>> ✘-1 ~/development/gomod/agouti_test 
>>
>> 22:51 $ go build main.go && ./main
>>
>> ../agouti/selectable.go:5:2: use of internal package 
>> github.com/sclevine/agouti/internal/element not allowed
>>
>> ../agouti/multiselection.go:3:8: use of internal package 
>> github.com/sclevine/agouti/internal/target not allowed
>>
>>
>> This suggests to me that the replace directive is working, but is being 
>> disallowed for "/internal" packages.  
>>
>> What is the correct way to fork this module please?
>>
>> Thanks,
>> Brad
>>
>

-- 
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/61dba235-25c4-4751-b7c1-20a3982d8219n%40googlegroups.com.

Reply via email to