Re: [go-nuts] package is not in GOROOT

2021-04-09 Thread rob
Thanks. 

If only the docs would make that clear.   

My experience with reading them is: clear only if previously known.   
Much frustration about modules could have been avoided by more clearly written 
documentation 

So it goes 




-- 
  rob
  drrob...@fastmail.com

On Fri, Apr 9, 2021, at 11:01 AM, wagner riffel wrote:
> On Wed, 7 Apr 2021 20:11:22 -0400
> rob  wrote:
> 
> > Would it be a bad idea to use my ~go/src as a module?
> > 
> 
> I don't think so, I do have one global module like this for my own toys
> and throwaways programs. Yes, it would need to adjust your import paths
> according to the module, when I migrated to module it was easier
> because everything was inside the same global folder, so I just needed
> to init a module with that name.
> 
> >    go mod tidy --> do I need this?
> > 
> 
> go mod tidy adds missing modules in go.mod/go.sum that you're importing
> from go sources, and removes dangling ones (not found in your go
> sources but in your go.mod/go.sum), it's wise to run it if you're
> initializing a module from an existing code base.
> 
> --wagner
>

-- 
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/af7de826-b922-42d0-b471-ba2cf0ecda8e%40www.fastmail.com.


Re: [go-nuts] package is not in GOROOT

2021-04-09 Thread 'wagner riffel' via golang-nuts
On Wed, 7 Apr 2021 20:11:22 -0400
rob  wrote:

> Would it be a bad idea to use my ~go/src as a module?
> 

I don't think so, I do have one global module like this for my own toys
and throwaways programs. Yes, it would need to adjust your import paths
according to the module, when I migrated to module it was easier
because everything was inside the same global folder, so I just needed
to init a module with that name.

>    go mod tidy --> do I need this?
> 

go mod tidy adds missing modules in go.mod/go.sum that you're importing
from go sources, and removes dangling ones (not found in your go
sources but in your go.mod/go.sum), it's wise to run it if you're
initializing a module from an existing code base.

--wagner

-- 
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/20210409120133.3a413a09%40pampas.


Re: [go-nuts] package is not in GOROOT

2021-04-07 Thread 'Carla Pfaff' via golang-nuts
On Thursday, 8 April 2021 at 02:11:50 UTC+2 rob wrote:

> Yes, you are absolutely correct that I've been struggling w/ modules. 
>
> Would it be a bad idea to use my ~go/src as a module? 
>
>   cd ~/go/src 
>
>   go mod init src 
>
>   go mod tidy --> do I need this? 
>
> And then I would have to edit my import statements slightly to include 
> the module reference. 
>
> --rob solomon 
>

That's basically what I suggested to you in my response. Only, instead of 
 "~/go/src" I called it "rob".

-- 
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/405db51e-f98a-48a5-9369-42b0f973dbacn%40googlegroups.com.


Re: [go-nuts] package is not in GOROOT

2021-04-07 Thread rob

Yes, you are absolutely correct that I've been struggling w/ modules.

Would it be a bad idea to use my ~go/src as a module?

  cd ~/go/src

  go mod init src

  go mod tidy --> do I need this?

And then I would have to edit my import statements slightly to include 
the module reference.


--rob solomon


On 4/7/21 10:24 AM, wagner riffel wrote:

Hi Rob, it's good that you got it working, but I feel you're struggling
with modules inferred from your past emails due a confusion between a
module namespace and the file system, your package import paths and go
commands are relative to a *module* and not a directory, your current
module namespace is detected similarly as a git repository is, that is,
traverse current working directory up until a go.mod is found (or .git
for git), and then if a module is found, you import packages or use the
go commands in the format of *module_name*/folder/..., not file system
paths, what go cares as a namespace is the module name, not
absolute/relative file system paths.

For example, suppose our current working directory is "~/gcode/" and it
has a go.mod named¹ "foo", note that the folder is named gcode but the
module is "foo", you would install the "rpng" package inside this
module namespace "foo" with:
$ go install foo/rpng

you can refer file path relatives alike as well:
$ go install ./rpng # OK
$ go install rpng # invalid, would fail with the same not found message

you can think as dot expanding to "foo", not the file system gcode
folder, to make clear that it's not about file system paths, changing
our current working directory to "tokenize", we still can mention "rpng"
relative to the module, not the file system:
$ cd ~/gcode/tokenize
$ go install foo/rpng
$ go install ../rpng # valid as well

I'm not sure if this helps you or causes even more confusions, if so
sorry.

BR.

--wagner

[1] the module name is usually a domain, but not necessarily, refer to
https://pkg.go.dev/golang.org/x/mod/module#CheckPath for detailed
description.


--
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/e5b963f1-ea49-3323-8512-29bb151bfe34%40fastmail.com.


Re: [go-nuts] package is not in GOROOT

2021-04-07 Thread rob
It does help me. 

Thanks 

-- 
  rob
  drrob...@fastmail.com

On Wed, Apr 7, 2021, at 10:24 AM, wagner riffel wrote:
> On Tue, 6 Apr 2021 19:39:00 -0400
> rob  wrote:
> 
> >  > This example is on Win10 using go 1.16.3
> > 
> > Now I've created a directory tree outside of ~/go/src.  I'm using ~
> > to mean %userprofile%, as this is win10
> > 
> > ~/gcode/rpng/rpng.go
> > 
> > ~/gcode/tokenize/tokenize.go
> > 
> > ~/gcode/hpcalc2/hpcalc2.go
> > 
> > And I updated my import statement to be "gcode/hpcalc2", etc.
> > 
> > Now I can use
> > 
> >   go run gcode/rpng/rpng.go
> > 
> > And I set GOBIN=c:\Users\rob\gcode
> > 
> >      go install gcode/rpng/rpng.go
> > 
> > and it installs to GOBIN.
> > 
> > At least it's working for me mostly the way it was before.  I just
> > had to abandon my ~/go directory
> > 
> > Thanks for answering
> > 
> > Rob
> > 
> 
> Hi Rob, it's good that you got it working, but I feel you're struggling
> with modules inferred from your past emails due a confusion between a
> module namespace and the file system, your package import paths and go
> commands are relative to a *module* and not a directory, your current
> module namespace is detected similarly as a git repository is, that is,
> traverse current working directory up until a go.mod is found (or .git
> for git), and then if a module is found, you import packages or use the
> go commands in the format of *module_name*/folder/..., not file system
> paths, what go cares as a namespace is the module name, not
> absolute/relative file system paths.
> 
> For example, suppose our current working directory is "~/gcode/" and it
> has a go.mod named¹ "foo", note that the folder is named gcode but the
> module is "foo", you would install the "rpng" package inside this
> module namespace "foo" with:
> $ go install foo/rpng
> 
> you can refer file path relatives alike as well:
> $ go install ./rpng # OK
> $ go install rpng # invalid, would fail with the same not found message
> 
> you can think as dot expanding to "foo", not the file system gcode
> folder, to make clear that it's not about file system paths, changing
> our current working directory to "tokenize", we still can mention "rpng"
> relative to the module, not the file system:
> $ cd ~/gcode/tokenize
> $ go install foo/rpng
> $ go install ../rpng # valid as well
> 
> I'm not sure if this helps you or causes even more confusions, if so
> sorry.
> 
> BR.
> 
> --wagner
> 
> [1] the module name is usually a domain, but not necessarily, refer to
> https://pkg.go.dev/golang.org/x/mod/module#CheckPath for detailed
> description.
>

-- 
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/47d67ccf-1d85-4bb2-9555-cf7ee4a8f9b0%40www.fastmail.com.


Re: [go-nuts] package is not in GOROOT

2021-04-07 Thread 'wagner riffel' via golang-nuts
On Tue, 6 Apr 2021 19:39:00 -0400
rob  wrote:

>  > This example is on Win10 using go 1.16.3
> 
> Now I've created a directory tree outside of ~/go/src.  I'm using ~
> to mean %userprofile%, as this is win10
> 
> ~/gcode/rpng/rpng.go
> 
> ~/gcode/tokenize/tokenize.go
> 
> ~/gcode/hpcalc2/hpcalc2.go
> 
> And I updated my import statement to be "gcode/hpcalc2", etc.
> 
> Now I can use
> 
>   go run gcode/rpng/rpng.go
> 
> And I set GOBIN=c:\Users\rob\gcode
> 
>      go install gcode/rpng/rpng.go
> 
> and it installs to GOBIN.
> 
> At least it's working for me mostly the way it was before.  I just
> had to abandon my ~/go directory
> 
> Thanks for answering
> 
> Rob
> 

Hi Rob, it's good that you got it working, but I feel you're struggling
with modules inferred from your past emails due a confusion between a
module namespace and the file system, your package import paths and go
commands are relative to a *module* and not a directory, your current
module namespace is detected similarly as a git repository is, that is,
traverse current working directory up until a go.mod is found (or .git
for git), and then if a module is found, you import packages or use the
go commands in the format of *module_name*/folder/..., not file system
paths, what go cares as a namespace is the module name, not
absolute/relative file system paths.

For example, suppose our current working directory is "~/gcode/" and it
has a go.mod named¹ "foo", note that the folder is named gcode but the
module is "foo", you would install the "rpng" package inside this
module namespace "foo" with:
$ go install foo/rpng

you can refer file path relatives alike as well:
$ go install ./rpng # OK
$ go install rpng # invalid, would fail with the same not found message

you can think as dot expanding to "foo", not the file system gcode
folder, to make clear that it's not about file system paths, changing
our current working directory to "tokenize", we still can mention "rpng"
relative to the module, not the file system:
$ cd ~/gcode/tokenize
$ go install foo/rpng
$ go install ../rpng # valid as well

I'm not sure if this helps you or causes even more confusions, if so
sorry.

BR.

--wagner

[1] the module name is usually a domain, but not necessarily, refer to
https://pkg.go.dev/golang.org/x/mod/module#CheckPath for detailed
description.

-- 
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/20210407112419.1e5e0132%40pampas.


[go-nuts] package is not in GOROOT

2021-04-06 Thread rob

> This example is on Win10 using go 1.16.3

Now I've created a directory tree outside of ~/go/src.  I'm using ~ to 
mean %userprofile%, as this is win10


~/gcode/rpng/rpng.go

~/gcode/tokenize/tokenize.go

~/gcode/hpcalc2/hpcalc2.go

And I updated my import statement to be "gcode/hpcalc2", etc.

Now I can use

 go run gcode/rpng/rpng.go

And I set GOBIN=c:\Users\rob\gcode

    go install gcode/rpng/rpng.go

and it installs to GOBIN.

At least it's working for me mostly the way it was before.  I just had 
to abandon my ~/go directory


Thanks for answering

Rob

--
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/99cc4059-012c-ab17-a5f2-80d652c41c14%40fastmail.com.


[go-nuts] package is not in GOROOT

2021-04-05 Thread rob
I'm still struggling w/ modules to get my code to compile.  This example 
is on Win10 using go 1.16.3


~/go/src/rpng/rpng.go

~/go/src/tokenize/tokenize.go

~/go/src/hpcalc2/hpcalc2.go

I'm logged into ~/go/src and I type this, like I used to do in the "old" 
days:


    go install rpng

Now I get this error: package rpng is not in GOROOT (\Program 
Files\Go\src\rpng)


I don't understand how to clear the error to get my code to compile.  In 
each of my directories in ~/go/src, I've run


    go mod init 

Yet the compiler cannot find other bits of code that I've written.

I am able to compile packages/modules in which I do not import anything 
else that I've written.


Any help would be appreciated.

--
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/a0757055-dd50-dbd2-642f-8c8634ed39f2%40fastmail.com.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210120 15:27]:
> On Wed, Jan 20, 2021 at 9:03 PM Marvin Renich  wrote:
> 
> > I still cannot find any mention of reserved import paths in any
> > documentation (go help modules/importpath/gopath).  It's just an issue
> > on the tracker.
> 
> When an important part of the implementation is undocumented then it's
> a documentation bug, hence the issue.

Absolutely.  I note the bug has been open for more than 18 months.

> Import path is not an URL. The Go build system in GOPATH does not
> interpret import paths as URLs. It's only the go get command that uses
> a well defined function for going from import path to URL to
> download/update repositories.
> 
> From the POV of the build system, Import paths refer to file system
> locations, again using a well defined function for that.

Agreed.  However, what I seem to be hearing about module mode is
different.  Perhaps I am misunderstanding.

> > Changing this for GOPATH
> > mode would, in my mind, be a major breaking change.
> 
> IMO it's a security issue that needs to be fixed. If anything puts a
> replacement of some stdlib package in your $GOPATH then you may have a
> problem.
> 
> Even on an uncompromised system, using the reserved path may in future
> clash with a new package of the same name added to stdlib, producing a
> log of confusion about why this bunch of packages build just fine and
> the rest does not.

GOPATH build mode searches GOROOT first, so no security issue.  Name
clash with future stdlib package is an issue, but much easier to deal
with.  Public discussion about reserving an import namespace is still
important.  If we had had this discussion prior to Go 1, I would have
suggested using one, well-known name for the first component of standard
library packages; perhaps "_stdlib".  Too late for that now.

> > I have never seen any mention of this issue on golang-nuts, though I
> > certainly could have missed it.  Perhaps some discussion took place on
> > golang-dev.  For a change this important, I would expect it to be
> > publicized much better.  If this is only going to affect module mode,
> > that is a different matter.
> 
> I don't recall where I became aware of the linked issue. It's too long ago.

I did not intend for this to sound like a complaint directed at you.  I
appreciate your pointing it out to me.  If the developers working on
this intend to make GOPATH mode fail for a large number of existing
local packages, I would appreciate it if they would say something on
golang-nuts.  This is somewhat different from deprecating the use of
first-level, non-dot names, but still allowing them if they don't clash
with stdlib packages.

...Marvin

-- 
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/20210120215112.f6hzzkpwhrjrqzep%40basil.wdw.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Jan Mercl
On Wed, Jan 20, 2021 at 9:03 PM Marvin Renich  wrote:

> I still cannot find any mention of reserved import paths in any
> documentation (go help modules/importpath/gopath).  It's just an issue
> on the tracker.

When an important part of the implementation is undocumented then it's
a documentation bug, hence the issue.

> Import paths without a dot in the first component (which is how I read
> what this issue is trying to claim as "reserved") have been part and
> parcel of the GOPATH way of building user packages since the beginning
> of the go tool, and this still works perfectly.  Not everyone wants or
> needs to put their go source code in a web-accessible location, or even
> in a version control system, for that matter.

Import path is not an URL. The Go build system in GOPATH does not
interpret import paths as URLs. It's only the go get command that uses
a well defined function for going from import path to URL to
download/update repositories.

>From the POV of the build system, Import paths refer to file system
locations, again using a well defined function for that.

> Changing this for GOPATH
> mode would, in my mind, be a major breaking change.

IMO it's a security issue that needs to be fixed. If anything puts a
replacement of some stdlib package in your $GOPATH then you may have a
problem.

Even on an uncompromised system, using the reserved path may in future
clash with a new package of the same name added to stdlib, producing a
log of confusion about why this bunch of packages build just fine and
the rest does not.

> I have never seen any mention of this issue on golang-nuts, though I
> certainly could have missed it.  Perhaps some discussion took place on
> golang-dev.  For a change this important, I would expect it to be
> publicized much better.  If this is only going to affect module mode,
> that is a different matter.

I don't recall where I became aware of the linked issue. It's too long ago.

-- 
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/CAA40n-UTJJwpW28gxS0bwujGjLOqXty_1cx2v2%3DML%2BacOL8R9Q%40mail.gmail.com.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210120 10:46]:
> On Wed, Jan 20, 2021 at 3:57 PM Marvin Renich  wrote:
> 
> > I don't understand what you are saying.  What is a "reserved import
> > path" and where is it defined?
> 
> See https://github.com/golang/go/issues/32819

???

Thanks for pointing this out!

My first paragraph was written when I thought the OP was using GOPATH
mode, not modules (and that the error message he received was from that
mode), and so my suggestion would have been correct and more clear.  In
fact, if using go build in GOPATH mode, it does, indeed give that
information and even more, enumerating the elements of GOPATH that it
searched.

I still cannot find any mention of reserved import paths in any
documentation (go help modules/importpath/gopath).  It's just an issue
on the tracker.

Import paths without a dot in the first component (which is how I read
what this issue is trying to claim as "reserved") have been part and
parcel of the GOPATH way of building user packages since the beginning
of the go tool, and this still works perfectly.  Not everyone wants or
needs to put their go source code in a web-accessible location, or even
in a version control system, for that matter.  Changing this for GOPATH
mode would, in my mind, be a major breaking change.

I have never seen any mention of this issue on golang-nuts, though I
certainly could have missed it.  Perhaps some discussion took place on
golang-dev.  For a change this important, I would expect it to be
publicized much better.  If this is only going to affect module mode,
that is a different matter.

...Marvin

-- 
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/20210120200316.ip773ss7ufnwmc4y%40basil.wdw.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Jan Mercl
On Wed, Jan 20, 2021 at 3:57 PM Marvin Renich  wrote:

> I don't understand what you are saying.  What is a "reserved import
> path" and where is it defined?

See https://github.com/golang/go/issues/32819

-- 
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/CAA40n-WM-5vOOkXjoyvMhMrOP9kohRFw%3DUhnNzy6Dey-2hgbCg%40mail.gmail.com.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Marvin Renich  [210120 09:58]:
> * Jan Mercl <0xj...@gmail.com> [210120 09:32]:
> > On Wed, Jan 20, 2021 at 2:58 PM Marvin Renich  wrote:
> > 
> > > The error message is really incomplete, and therefore confusing.  It
> > > should be "package ... is not in GOROOT or any element of GOPATH".
> > 
> > _That_ would be incorrect and confusing. Reserved import paths are
> > never searched for in GOPATH.

Perhaps you missed my third paragraph.  The first paragraph was written
when I was still thinking the OP was using GOPATH, not modules.

I still don't know what you mean by "reserved import path".

...Marvin

-- 
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/20210120150540.qnfkvgnj33pvubmd%40basil.wdw.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Jan Mercl <0xj...@gmail.com> [210120 09:32]:
> On Wed, Jan 20, 2021 at 2:58 PM Marvin Renich  wrote:
> 
> > The error message is really incomplete, and therefore confusing.  It
> > should be "package ... is not in GOROOT or any element of GOPATH".
> 
> _That_ would be incorrect and confusing. Reserved import paths are
> never searched for in GOPATH.

I don't understand what you are saying.  What is a "reserved import
path" and where is it defined?

When using GOPATH (not modules), when the go toolchain encounters

  import "path/to/package"

it first looks for a directory obtained from (roughly)
filepath.Join(GOROOT, "src", "path/to/package"), if it does not find the
package there, it does the same thing, replacing GOROOT with,
successively, each element of GOPATH.  So, if it cannot find the given
import path, then the package is not in GOROOT, nor is it in any element
of GOPATH.  What is confusing about that?

...Marvin

-- 
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/20210120145736.32uiaivzhtlo6dn4%40basil.wdw.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Jan Mercl
On Wed, Jan 20, 2021 at 2:58 PM Marvin Renich  wrote:

> The error message is really incomplete, and therefore confusing.  It
> should be "package ... is not in GOROOT or any element of GOPATH".

_That_ would be incorrect and confusing. Reserved import paths are
never searched for in GOPATH.

-- 
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/CAA40n-UMzKZpj0Kn1zPMzgRTXGNiyUpbOQT4fSUL93E8RdOSYg%40mail.gmail.com.


Re: [go-nuts] package is not in goroot

2021-01-20 Thread Marvin Renich
* Alexander Mills  [210119 16:54]:
> i am getting this weird error message:
> 
>  package twitch/go-scripts/dynamo-creators-to-s3/lib is not in GOROOT 
> (/usr/local/Cellar/go/1.15.6/libexec/src/twitch/go-scripts/dynamo-creators-to-s3/lib)
> 
> my GOPATH=$PWD/scripts/go
> 
> so there is only 1 GOPATH
> 
> [image: Screen Shot 2021-01-19 at 1.52.30 PM.png]

The error message is really incomplete, and therefore confusing.  It
should be "package ... is not in GOROOT or any element of GOPATH".

I had written an answer based on an environment using GOPATH before
carefully looking at your screenshot (please paste text rather than
using screenshots).  It seems you have a go.mod file, so GOPATH is not
relevant.

If using modules rather than GOPATH, the error message is probably
correct, as GOPATH is not used except as a place to cache downloaded
modules under the "$GOPATH/pkg" directory.

As best as I can tell (and I am still using GOPATH, so I may be
completely wrong), a Go program in a module can only use web-aware
import paths (except for standard library packages).  Perhaps someone
else can clarify that, and how to set up your directory structure.  I
think there was recent thread with a similar problem, but I did not pay
much attention to it.

Personally, I think that requiring (as opposed to allowing) web-aware
import paths is a terrible (no, I mean really, really terrible) design.

On the other hand, if you were intending to use GOPATH, but it was
incorrectly set and so the go tool kindly (???) created a go.mod file
for you, I can probably help you figure out your problem.  First, erase
go.mod.  Then, ensure GOPATH is what you expect (use "go env GOPATH",
rather than "echo $GOPATH").  If that doesn't lead you to an answer,
post the output from go env and the go command you are using that gives
the error (go build, go test, etc.).

...Marvin

-- 
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/20210120135843.rtxdxzbql5hkx3gn%40basil.wdw.


Re: [go-nuts] package is not in goroot

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 16:08 -0800, Alexander Mills wrote:
> I have never seen the dot needed, I have used plenty of packages that
> are in GOPATH but not GOROOT


https://go.googlesource.com/go/+/go1.15.6/src/cmd/go/internal/search/search.go#542

This is why it is saying that it's expecting it to be in GOROOT. Why it
can't find it? I don't know, but you haven't said what the error was in
response to.


-- 
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/90e329865ddd24c1f50f0ca2fede17ff2ee37d2e.camel%40kortschak.io.


Re: [go-nuts] package is not in goroot

2021-01-19 Thread 'Dan Kortschak' via golang-nuts
On Tue, 2021-01-19 at 13:54 -0800, Alexander Mills wrote:
> i am getting this weird error message:
> 
>  package twitch/go-scripts/dynamo-creators-to-s3/lib is not in GOROOT
> (/usr/local/Cellar/go/1.15.6/libexec/src/twitch/go-scripts/dynamo-
> creators-to-s3/lib)
> 
> my GOPATH=$PWD/scripts/go
> 
> so there is only 1 GOPATH

Packages that are not in GOROOT must have a dot in the first path
element. Your import path doesn't; it's "twitch".


-- 
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/3e1a5f86d1cb6724deeb48cdc4017b3a94f459ef.camel%40kortschak.io.


[go-nuts] package is not in goroot

2021-01-19 Thread Alexander Mills
i am getting this weird error message:

 package twitch/go-scripts/dynamo-creators-to-s3/lib is not in GOROOT 
(/usr/local/Cellar/go/1.15.6/libexec/src/twitch/go-scripts/dynamo-creators-to-s3/lib)

my GOPATH=$PWD/scripts/go

so there is only 1 GOPATH

[image: Screen Shot 2021-01-19 at 1.52.30 PM.png]

-- 
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/48058023-7827-407f-8408-40e5d9b388dbn%40googlegroups.com.