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 get is also the main 
entry point for working with versioned modules."

Best,
thepudds

On Friday, October 19, 2018 at 7:59:58 PM UTC-4, Paul Jolly wrote:
>
> 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 other. 
>
> Thanks 
> On Sat, 20 Oct 2018 at 00:44, Mark Volkmann  > wrote: 
> > 
> > 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 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, Oct 19, 2018 at 6:13 PM Paul Jolly  > wrote: 
> >>> 
> >>> 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  >>> package bar 
> >>> import "fmt" 
> >>> func Hello() { 
> >>> fmt.Println("Hello from bar!") 
> >>> } 
> >>> EOD 
> >>> $ cd $HOME 
> >>> $ mkdir foo 
> >>> $ cd foo 
> >>> $ go mod init example.com/foo 
> >>> go: creating new go.mod: module example.com/foo 
> >>> $ cat  >>> package main 
> >>> 
> >>> import "example.com/bar" 
> >>> 
> >>> func main() { 
> >>> bar.Hello() 
> >>> } 
> >>> EOD 
> >>> $ go mod edit -require=example.com/bar@v0.0.0 -replace=
> example.com/bar=$HOME/bar 
> >>> $ cat go.mod 
> >>> module example.com/foo 
> >>> 
> >>> require example.com/bar v0.0.0 
> >>> 
> >>> replace example.com/bar => /root/bar 
> >>> $ go run . 
> >>> Hello from bar! 
> >>> On Fri, 19 Oct 2018 at 21:42, 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" 
> >>> > func Hello() { 
> >>> > fmt.Println("Hello from bar!") 
> >>> > } 
> >>> > 
> >>> > It also contains the file go.mod which just contains: 
> >>> > 
> >>> > module bar 
> >>> > 
> >>> > The demo application in another directory imports this as "foo/bar" 
> in the file main.go. 
> >>> > It has a go.mod file that contains the following: 
> >>> > 
> >>> > module demo 
> >>> > replace foo/bar => /Users/Mark/foo/bar 
> >>> > 
> >>> > When I enter "go run main.go" in the directory of the demo code I 
> get 
> >>> > build demo: cannot find module for path foo/bar 
> >>> > 
> >>> > Is there something wrong with my use of the "replace" directive? 
> >>> > 
> >>> > None of this code is under the directory pointed to by GOPATH 
> because I'm trying to use Go modules for everything in this demo. 
> >>> > 
> >>> > -- 
> >>> > R. Mark Volkmann 
> >>> > Object Computing, Inc. 
> >>> > 
> >>> > -- 
> >>> > 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...@googlegroups.com . 
> >>> > For more options, visit https://groups.google.com/d/optout. 
> >> 
> >> 
> >> 
> >> -- 
> >> R. Mark Volkmann 
> >> Object Computing, Inc. 
> > 
> > 
> > 
> > -- 
> > R. Mark Volkmann 
> > Object Computing, Inc. 
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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 other.

Thanks
On Sat, 20 Oct 2018 at 00:44, Mark Volkmann  wrote:
>
> 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 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, Oct 19, 2018 at 6:13 PM Paul Jolly  wrote:
>>>
>>> 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 >> package bar
>>> import "fmt"
>>> func Hello() {
>>> fmt.Println("Hello from bar!")
>>> }
>>> EOD
>>> $ cd $HOME
>>> $ mkdir foo
>>> $ cd foo
>>> $ go mod init example.com/foo
>>> go: creating new go.mod: module example.com/foo
>>> $ cat >> package main
>>>
>>> import "example.com/bar"
>>>
>>> func main() {
>>> bar.Hello()
>>> }
>>> EOD
>>> $ go mod edit -require=example.com/bar@v0.0.0 
>>> -replace=example.com/bar=$HOME/bar
>>> $ cat go.mod
>>> module example.com/foo
>>>
>>> require example.com/bar v0.0.0
>>>
>>> replace example.com/bar => /root/bar
>>> $ go run .
>>> Hello from bar!
>>> On Fri, 19 Oct 2018 at 21:42, 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"
>>> > func Hello() {
>>> > fmt.Println("Hello from bar!")
>>> > }
>>> >
>>> > It also contains the file go.mod which just contains:
>>> >
>>> > module bar
>>> >
>>> > The demo application in another directory imports this as "foo/bar" in 
>>> > the file main.go.
>>> > It has a go.mod file that contains the following:
>>> >
>>> > module demo
>>> > replace foo/bar => /Users/Mark/foo/bar
>>> >
>>> > When I enter "go run main.go" in the directory of the demo code I get
>>> > build demo: cannot find module for path foo/bar
>>> >
>>> > Is there something wrong with my use of the "replace" directive?
>>> >
>>> > None of this code is under the directory pointed to by GOPATH because I'm 
>>> > trying to use Go modules for everything in this demo.
>>> >
>>> > --
>>> > R. Mark Volkmann
>>> > Object Computing, Inc.
>>> >
>>> > --
>>> > 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.
>>> > For more options, visit https://groups.google.com/d/optout.
>>
>>
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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 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, Oct 19, 2018 at 6:13 PM Paul Jolly  wrote:
>
>> 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 > package bar
>> import "fmt"
>> func Hello() {
>> fmt.Println("Hello from bar!")
>> }
>> EOD
>> $ cd $HOME
>> $ mkdir foo
>> $ cd foo
>> $ go mod init example.com/foo
>> go: creating new go.mod: module example.com/foo
>> $ cat > package main
>>
>> import "example.com/bar"
>>
>> func main() {
>> bar.Hello()
>> }
>> EOD
>> $ go mod edit -require=example.com/bar@v0.0.0 -replace=
>> example.com/bar=$HOME/bar
>> $ cat go.mod
>> module example.com/foo
>>
>> require example.com/bar v0.0.0
>>
>> replace example.com/bar => /root/bar
>> $ go run .
>> Hello from bar!
>> On Fri, 19 Oct 2018 at 21:42, 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"
>> > func Hello() {
>> > fmt.Println("Hello from bar!")
>> > }
>> >
>> > It also contains the file go.mod which just contains:
>> >
>> > module bar
>> >
>> > The demo application in another directory imports this as "foo/bar" in
>> the file main.go.
>> > It has a go.mod file that contains the following:
>> >
>> > module demo
>> > replace foo/bar => /Users/Mark/foo/bar
>> >
>> > When I enter "go run main.go" in the directory of the demo code I get
>> > build demo: cannot find module for path foo/bar
>> >
>> > Is there something wrong with my use of the "replace" directive?
>> >
>> > None of this code is under the directory pointed to by GOPATH because
>> I'm trying to use Go modules for everything in this demo.
>> >
>> > --
>> > R. Mark Volkmann
>> > Object Computing, Inc.
>> >
>> > --
>> > 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.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>


-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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, Oct 19, 2018 at 6:13 PM Paul Jolly  wrote:

> 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  package bar
> import "fmt"
> func Hello() {
> fmt.Println("Hello from bar!")
> }
> EOD
> $ cd $HOME
> $ mkdir foo
> $ cd foo
> $ go mod init example.com/foo
> go: creating new go.mod: module example.com/foo
> $ cat  package main
>
> import "example.com/bar"
>
> func main() {
> bar.Hello()
> }
> EOD
> $ go mod edit -require=example.com/bar@v0.0.0 -replace=
> example.com/bar=$HOME/bar
> $ cat go.mod
> module example.com/foo
>
> require example.com/bar v0.0.0
>
> replace example.com/bar => /root/bar
> $ go run .
> Hello from bar!
> On Fri, 19 Oct 2018 at 21:42, 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"
> > func Hello() {
> > fmt.Println("Hello from bar!")
> > }
> >
> > It also contains the file go.mod which just contains:
> >
> > module bar
> >
> > The demo application in another directory imports this as "foo/bar" in
> the file main.go.
> > It has a go.mod file that contains the following:
> >
> > module demo
> > replace foo/bar => /Users/Mark/foo/bar
> >
> > When I enter "go run main.go" in the directory of the demo code I get
> > build demo: cannot find module for path foo/bar
> >
> > Is there something wrong with my use of the "replace" directive?
> >
> > None of this code is under the directory pointed to by GOPATH because
> I'm trying to use Go modules for everything in this demo.
> >
> > --
> > R. Mark Volkmann
> > Object Computing, Inc.
> >
> > --
> > 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.
> > For more options, visit https://groups.google.com/d/optout.
>


-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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  /root/bar
$ go run .
Hello from bar!
On Fri, 19 Oct 2018 at 21:42, 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"
> func Hello() {
> fmt.Println("Hello from bar!")
> }
>
> It also contains the file go.mod which just contains:
>
> module bar
>
> The demo application in another directory imports this as "foo/bar" in the 
> file main.go.
> It has a go.mod file that contains the following:
>
> module demo
> replace foo/bar => /Users/Mark/foo/bar
>
> When I enter "go run main.go" in the directory of the demo code I get
> build demo: cannot find module for path foo/bar
>
> Is there something wrong with my use of the "replace" directive?
>
> None of this code is under the directory pointed to by GOPATH because I'm 
> trying to use Go modules for everything in this demo.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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 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 file go.mod which just contains:
>>
>> module bar
>>
>> The demo application in another directory imports this as "foo/bar" in
>> the file main.go.
>> It has a go.mod file that contains the following:
>>
>> module demo
>> replace foo/bar => /Users/Mark/foo/bar
>>
>> When I enter "go run main.go" in the directory of the demo code I get
>> build demo: cannot find module for path foo/bar
>>
>> Is there something wrong with my use of the "replace" directive?
>>
>
> Base in this:
>
> https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive
>
> my understanding is that the path you are replacing has to first be
> identified as a locatable import path, as opposed to being able to define
> the location of a previously invalid path.
>
>
> What is a “locatable import path”?
>

What I mean is an import path that the Go tool could locate. If you are
outside a GOPATH then that would mean either a vcs pattern, something
relative to the module, or something in the module cache (assumptions so
far).


> If your top level module is called "demo" and it contains a nested packed
> "bar",
>
>
> bar is not a nested package. It’s in a completely different directory
> structure from the demo app.
>

So then it's even more to my point, where on its own the go tool would have
no idea where to find "foo/bar"


> then in the go.mod I would assume it to be called "demo/bar". If you
> forget about it actually currently existing under the "demo" location on
> disk, with the absence of GOPATH or a fully qualified vcs import path, how
> else would the module system find "bar" if not relative to "demo"?
>
>
> That’s what I thought the “replace” directive could do. I supplied the
> full path there.
>

And that's the part where I am under the impression that the Go tool first
wants to know where it would find "foo/bar" before it will replace it with
another location. It's not a vcs and it's not relative to the module you
are building.


> I'm still learning about Go modules so I could be totally wrong.
>
>>
>> None of this code is under the directory pointed to by GOPATH because I'm
>> trying to use Go modules for everything in this demo.
>>
>> --
>> R. Mark Volkmann
>> Object Computing, Inc.
>>
>> --
>> 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.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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 contains the file bar.go which contains:
>> 
>> package bar
>> import "fmt"
>> func Hello() {
>>  fmt.Println("Hello from bar!")
>> }
>> 
>> It also contains the file go.mod which just contains:
>> 
>> module bar
>> 
>> The demo application in another directory imports this as "foo/bar" in the 
>> file main.go.
>> It has a go.mod file that contains the following:
>> 
>> module demo
>> replace foo/bar => /Users/Mark/foo/bar
>> 
>> When I enter "go run main.go" in the directory of the demo code I get
>> build demo: cannot find module for path foo/bar
>> 
>> Is there something wrong with my use of the "replace" directive?
> 
> 
> Base in this:
> https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive
> 
> my understanding is that the path you are replacing has to first be 
> identified as a locatable import path, as opposed to being able to define the 
> location of a previously invalid path. 

What is a “locatable import path”?

> If your top level module is called "demo" and it contains a nested packed 
> "bar",

bar is not a nested package. It’s in a completely different directory structure 
from the demo app.

> then in the go.mod I would assume it to be called "demo/bar". If you forget 
> about it actually currently existing under the "demo" location on disk, with 
> the absence of GOPATH or a fully qualified vcs import path, how else would 
> the module system find "bar" if not relative to "demo"? 

That’s what I thought the “replace” directive could do. I supplied the full 
path there.

> I'm still learning about Go modules so I could be totally wrong. 
>> 
>> None of this code is under the directory pointed to by GOPATH because I'm 
>> trying to use Go modules for everything in this demo.
>> 
>> -- 
>> R. Mark Volkmann
>> Object Computing, Inc.
>> -- 
>> 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.
>> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


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"
> func Hello() {
> fmt.Println("Hello from bar!")
> }
>
> It also contains the file go.mod which just contains:
>
> module bar
>
> The demo application in another directory imports this as "foo/bar" in
> the file main.go.
> It has a go.mod file that contains the following:
>
> module demo
> replace foo/bar => /Users/Mark/foo/bar
>
> When I enter "go run main.go" in the directory of the demo code I get
> build demo: cannot find module for path foo/bar
>
> Is there something wrong with my use of the "replace" directive?
>

Base in this:
https://github.com/golang/go/wiki/Modules#when-should-i-use-the-replace-directive

my understanding is that the path you are replacing has to first be
identified as a locatable import path, as opposed to being able to define
the location of a previously invalid path.

If your top level module is called "demo" and it contains a nested packed
"bar", then in the go.mod I would assume it to be called "demo/bar". If you
forget about it actually currently existing under the "demo" location on
disk, with the absence of GOPATH or a fully qualified vcs import path, how
else would the module system find "bar" if not relative to "demo"?

I'm still learning about Go modules so I could be totally wrong.



> None of this code is under the directory pointed to by GOPATH because I'm
> trying to use Go modules for everything in this demo.
>
> --
> R. Mark Volkmann
> Object Computing, Inc.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[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 file go.mod which just contains:

module bar

The demo application in another directory imports this as "foo/bar" in the
file main.go.
It has a go.mod file that contains the following:

module demo
replace foo/bar => /Users/Mark/foo/bar

When I enter "go run main.go" in the directory of the demo code I get
build demo: cannot find module for path foo/bar

Is there something wrong with my use of the "replace" directive?

None of this code is under the directory pointed to by GOPATH because I'm
trying to use Go modules for everything in this demo.

-- 
R. Mark Volkmann
Object Computing, Inc.

-- 
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.
For more options, visit https://groups.google.com/d/optout.