[go-nuts] Go modules and replace

2018-10-19 Thread Mark Volkmann
I have a simple demo application that wants to use a package that is on my local file system. The code for the package is in /Users/Mark/foo/bar. This directory contains the file bar.go which contains: package bar import "fmt" func Hello() { fmt.Println("Hello from bar!") } It also contains the f

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Justin Israel
On Sat, Oct 20, 2018, 9:42 AM Mark Volkmann wrote: > I have a simple demo application that wants to use a package that is on my > local file system. > The code for the package is in /Users/Mark/foo/bar. > This directory contains the file bar.go which contains: > > package bar > import "fmt" > fun

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Mark Volkmann
> On Oct 19, 2018, at 4:48 PM, Justin Israel wrote: > > > >> On Sat, Oct 20, 2018, 9:42 AM Mark Volkmann >> wrote: >> I have a simple demo application that wants to use a package that is on my >> local file system. >> The code for the package is in /Users/Mark/foo/bar. >> This directory con

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Justin Israel
On Sat, Oct 20, 2018, 11:34 AM Mark Volkmann wrote: > > On Oct 19, 2018, at 4:48 PM, Justin Israel wrote: > > > > On Sat, Oct 20, 2018, 9:42 AM Mark Volkmann > wrote: > >> I have a simple demo application that wants to use a package that is on >> my local file system. >> The code for the packag

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Paul Jolly
Hi Mark, When importing a module package, the first element in the path must contain a ".". Hence "foo" is invalid. Here is a working example: $ cd $HOME $ mkdir bar $ cd bar $ go mod init example.com/bar go: creating new go.mod: module example.com/bar $ cat

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Mark Volkmann
Thank you so much! I actually got it to work without having a dot in the first part of the import path. It seems the only thing I was missing was this line in mod.go for the demo code: require foo/bar v0.0.0 I just had the replace directive line without a corresponding require directive. On Fri, O

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Mark Volkmann
I see though that "go mode edit" really wants there to be a dot in the first part of the import path. Where can I read about that requirement? On Fri, Oct 19, 2018 at 6:30 PM Mark Volkmann wrote: > Thank you so much! I actually got it to work without having a dot in the > first part of the impor

Re: [go-nuts] Go modules and replace

2018-10-19 Thread Paul Jolly
Actually, now that I think about it, this restriction was relaxed. So the dot in the first part of the path is not a requirement. It appears however that go mod edit has partially regressed in this respect. Please can you raise an issue? That way we can have the behaviour confirmed one way or the

Re: [go-nuts] Go modules and replace

2018-10-19 Thread thepudds1460
Hi all, See some related discussion here regarding dots in import paths and modules: https://github.com/golang/go/issues/27503 including this comment from bcmills: "Dotless paths in general are reserved for the standard library; go get has (to my knowledge) never worked with them, but go