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/4dca8bec-f7e9-4963-ae2a-e3e277cdada6n%40googlegroups.com.

Reply via email to