On Tuesday, 6 April 2021 at 02:13:14 UTC+2 rob wrote:

> 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 
>
>
Put them in a directory, e.g. "rob". This can be anywhere, it doesn't have 
to be under "~/go/src":

  rob/rpng/rpng.go 
  rob/tokenize/tokenize.go 
  rob/hpcalc2/hpcalc2.go

 In each of my directories in ~/go/src, I've run 
>
>     go mod init <module name> 
>

Delete these go.mod/go.sum files that you created in the sub-directories.

Then go in the "rob" directory and init the module "rob":

  cd rob
  go mod init rob

Result:

  rob/go.mod
  rob/go.sum
  rob/rpng/rpng.go 
  rob/tokenize/tokenize.go 
  rob/hpcalc2/hpcalc2.go

Now always import the packages with the module prefix "rob/":

  import "rob/rpng"
  import "rob/tokenize"
  ...

-- 
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/881ade6d-21cd-43dd-ade1-2aeb983a0738n%40googlegroups.com.

Reply via email to