I had the same situation and this worked perfectly:

replace mylib => ../mylib

If it doesn't - check paths, name of the "mylib" module, etc



суббота, 8 августа 2020 г. в 21:20:56 UTC+3, Sankar: 

> Hi
>
> I have a monolithic source repository that is NOT in git, mercurial etc.
>
> The directory structure is:
>
> root
> |
> |--- mylib
> |         | --- mylib.go
> |         | --- go.mod
> |--- svc1
> |       | --- go.mod
> |       | --- cmd
> |                 | ---- svc1.go
> |--- svc2
> |       | --- go.mod
> |       | --- cmd
> |                 | ---- svc2.go
>
> Here there is a `mylib` which is a common library. `svc1` and `svc2` are 
> two golang http servers that come with their own `go.mod` files. Now I want 
> to import the `mylib` in the `svc1` and `svc2` sources and the go.mod files.
>
> Can someone tell me how to achieve this ? I can modify the go.mod of 
> `mylib` to anything but cannot publish the sources to a VCS.
>
> I tried adding the following in the go.mod files of svc1 and svc2 but it 
> did not work.
> replace (
> my.lib latest => ../mylib latest
> )
>
> Any other suggestions to get this working ? Thanks.
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/2b4b34b3-3555-4b89-8e5e-b63035a9f238n%40googlegroups.com.

Reply via email to