On Tuesday, 30 June 2020 06:34:48 UTC+2, Jason E. Aten wrote:
>
> I have a files laid out like this (OSX):
>
> ~/go/src/github.com/user/fish/api/client/wanda.go
>
> ~/go/src/github.com/user/fish/go.mod with first line "module 
> github.com/liked/movies/v2"
>
> ~/go/src/github.com/user/fish/cmd/demo/main.go that does: import client "
> github.com/liked/movies/v2/api/client"
>
> ~/go/src/github.com/user/fish/cmd/demo $ go build  ## with GO111MODULE 
> unset, under go1.14.4. Also GOPRIVATE=github.com/user   and 
> GOPATH=$HOME/go
>  
> go: finding module for package github.com/liked/movies/v2/api/client
> main.go:4:2: module github.com/liked/movies/v2@latest found 
> (v2.0.0-alpha.1), but does not contain package 
> github.com/liked/movies/v2/api/client
>
> So the demo/main.go import of the client package is not resolved. Is it 
> possible, in general, to import a package within a module? 
>

Yes, of course.

Start of by deciding whether you want to use Go Modules or
GOPATH builds and set GO111MODULE accordingly. Your
setup uses the defaults which change from release to release
and doing it in a deterministic way.

Then: You did not show the package clause of wanda.go.

It is strange that cmd/demo doesn't recognize its own module.
Is there a fundamental reason to name the module github.com/liked/movies
while the repo is github.com/user/fish ?

Last: Did you try a replace directive?

V.
 
 

-- 
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/8c21dc52-9aa9-4d36-9029-ede4f93d7702o%40googlegroups.com.

Reply via email to