On Tuesday, 3 December 2019 18:36:49 UTC+1, Bruno Albuquerque wrote:
>
> It will fail because it will say it can not find "project"
>
> If I add a proper go.mod file in the example directory, then it works but 
> it actually pulls a version of project from the vcs (this is, of course, 
> assuming there is already a committed version. otherwise it will also fail) 
> so if I had made changes locally to library.go, they will not be seem.
>
> So what should I do to satisfy the following requirements:
>
> 1 - go run example.go in the example directory works.
> 2 - Local changes to library.go will be seem when I do 1.
> 3 - It will still look rigth when everything is commited to vcs (meaning 
> that if someone check it out somewhere else, 1 and 2 will still work.
>

That one is dead simple. First note that example.go and library.go
are intimately coupled: The first relies on a certain version of the
later and the later requires the first to match to be a useful example.

That means these two files are part of the _same_ project:
Put the go.mod file into the project folder. (You just need one
go.mod file. not one per directory. One in the toplevel project
folder.)

Like this example.go is part of the module and it will find the project.
So 1) and 2) are satisfied.

3) is also satisfied.

V.
  

-- 
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/706dcf32-5c23-4ac4-999c-9f729ed19cb5%40googlegroups.com.

Reply via email to