Re: [go-nuts] still struggling to understand modules

2021-02-26 Thread Brian Candler
On Friday, 26 February 2021 at 12:27:09 UTC rob wrote: > When I try "go mod init" in my /home/rob/go/src, I get an error > > go: cannot determine module path for source directory /home/rob/go/src > (outside GOPATH, module path must be specified) > > What it means is, you must give a name (impor

Re: [go-nuts] still struggling to understand modules

2021-02-26 Thread rob
Nope.  I didn't solve it.  The code compiles because of GO111MODULE=auto and I did not notice that when I posted yesterday.  The code does not compile when GO111MODULE=on The simple instructions that I suggest be added to the documentation would benefit from having a section called "Common e

Re: [go-nuts] still struggling to understand modules

2021-02-25 Thread rob
I solved my issue by restarting the terminal program.  The code now compiles.  And I also tested on Win10 and go 1.16. I'm glad I asked my question, because nothing I read said that all I had to do to use modules is to go into each code directory I use and    go mod init Perhaps that simpl

Re: [go-nuts] still struggling to understand modules

2021-02-25 Thread rob
Thanks for answering me. Now I have a curious problem.  Most of the code I've written is compiling.  I'm using go 1.15.8 under ubuntu.  I did     I'm logged into ~/go/src     export GO111MODULE=on     cd multack    This is my code     go mod init multack     cd ..     Now I'm back

Re: [go-nuts] still struggling to understand modules

2021-02-24 Thread Ian Lance Taylor
On Wed, Feb 24, 2021 at 5:24 PM rob wrote: > > I was unclear. > > My directories are structured so that each is its own program. For > example, I have programs w/ these names, and the code is in that > directory. That's how I understood GOPATH was supposed to be organized > > ~/go/src/dsrt > > ~/

Re: [go-nuts] still struggling to understand modules

2021-02-24 Thread Ralph Seichter
* rob: > I'm also curious as to WHY GOPATH is being removed. Because GOPATH forced people to store all their Go code under a specific directory, which is a hindrance. go.mod allows users to choose different paths for different projects. It also enables programmers to use Git or other VCS to store

Re: [go-nuts] still struggling to understand modules

2021-02-24 Thread rob
And another question.  Some of my code is defined as package main and other code directories are package calc as it is intended to be imported by other of my code packages. Am I expected to run go mod init on all of my code, or only those that are imported by package main code? Please forg

Re: [go-nuts] still struggling to understand modules

2021-02-24 Thread rob
I was unclear. My directories are structured so that each is its own program. For example, I have programs w/ these names, and the code is in that directory.  That's how I understood GOPATH was supposed to be organized ~/go/src/dsrt ~/go/src/regex ~/go/src/comparehashes There are at least

Re: [go-nuts] still struggling to understand modules

2021-02-23 Thread Nick Keets
Hello rob, here's what I do. For every dir in ~/go/src run go mod init with the dir name. e.g.: cd ~/go/src/foo go mod init foo cd ~/go/src/bar go mod init bar ... If package foo depends on libfoo (also in ~/go/src) you can add a replace line in foo's go.mod e.g. echo "replace libfoo => ../libfo

Re: [go-nuts] still struggling to understand modules

2021-02-23 Thread Ian Lance Taylor
On Tue, Feb 23, 2021 at 5:49 PM rob wrote: > > I'm looking for a conversion guide for the complete idiot, or for > dummies if that's preferable. Does this article from the Go blog help? https://blog.golang.org/migrating-to-go-modules Ian -- You received this message because you are subscribed

Re: [go-nuts] still struggling to understand modules

2021-02-23 Thread Amit Saha
On Wed, Feb 24, 2021 at 12:49 PM rob wrote: > > Hi. I'm a hobby programmer. I've been able to learn and use gopath > mode for a while. I've accumulated 20+ programs that I use that were > build using gopath mode. I'm not using a package manager, as all my > code is in GOPATH, ie, ~/go/src/ > >

[go-nuts] still struggling to understand modules

2021-02-23 Thread rob
Hi.  I'm a hobby programmer.  I've been able to learn and use gopath mode for a while.  I've accumulated 20+ programs that I use that were build using gopath mode.  I'm not using a package manager, as all my code is in GOPATH, ie, ~/go/src/ I don't understand how to convert this to modules.  I