-
Notifications
You must be signed in to change notification settings - Fork 17.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmd/go: cannot find module for path #32886
Comments
I've updated my
and no success, same error message:
|
I've cloned the cmd/go/internal/modload/build.go // findModule returns the module containing the package at path,
// needed to build the package at target.
func findModule(target, path string) module.Version {
pkg, ok := loaded.pkgCache.Get(path).(*loadPkg)
if ok {
if pkg.err != nil {
base.Fatalf("build %v: cannot load %v: %v", target, path, pkg.err)
}
return pkg.mod
}
if path == "command-line-arguments" {
return Target
}
if printStackInDie {
debug.PrintStack()
}
base.Fatalf("build %v: cannot find module for path %v", target, path)
panic("unreachable")
} Trying to trace the moment when my |
The You mentioned a few commands that were failing.
|
Morning @jayconrod thank you for the reply. Yes
1. What directory is the go.mod file in?In the case of 2. You mentioned you changed the module path to code.blockwave.com/blockwave/blockwave. This is not a prefix of code.blockwave.com/blockwave/core.components.engine/wave/plugin-master though. Should it be code.blockwave.com/blockwave instead?Not for this situation, in our repo server,
Both directories each contain their own 3. Assuming the module path is code.blockwave.com/blockwave, is there a subdirectory core.components.engine/wave/plugin-master within the directory containing the go.mod file? For example, if your go.mod file is ~/Repositories/code.blockwave.com/blockwave, there should be a directory ~/Repositories/code.blockwave.com/blockwave/core.components.engine/wave/plugin-master.Yes a directory that contains the
I can
But if I try to build it from the root module
|
Ah, ok, so Do you have any requirements or replacements in the Assuming the module is not already required and is not replaced, the Go command will clone the git repository for this module, then will look at the latest semantic version tag ("latest" as defined in You can see which version is selected with |
@jayconrod Thank you for the help!.
I'd say it's more like
It also succeeds if I build it from the root of the module (where
But if fails to build or be found if I import it in to another module (like Do you have any requirements or replacements in the go.mod for code.blockwave.com/blockwave/blockwave related to code.blockwave.com/blockwave/core.components.engine?Nope, no replacement directives; I have one but it's for a local dependency that is not related to
You can see which version is selected with go list -m -json code.blockwave.com/blockwave/core.components.engine. Do you know if there is a wave/plugin-master subdirectory in that repository at that version?Yes, here is the output:
|
Does the directory |
Yes, and it' is pushed and accessible from the remote repo:
And it does exist under
|
Hmm, strange. Anything usual about that file? For example, any build tags that would exclude it from being built on the target platform? If you run |
If run
And
The
|
Not sure if it provides additional insights but I've patched/butchered a bit the Go source as depicted here: And the missing package
|
It's curious that What happens with Are you able to reduce this to a reproducible example? Does this reproduce with go1.13beta1? If you're interested in debugging this further yourself, |
When I run
When I run it from the project that produces the executable (I've reverted back to the original
and it fails.
I tried reproducing it here, to no avail:
Thinking that the "." that we have as part of the module names would cause an issue, but that project builds successfully ..., do you think it could be the 2 "." in
Will give it a go |
Just tried with
For reference I followed this instructions to install it: |
After moving the If I search the
For reference, other packages do show up:
As a side note ... is there a faster way to do Go builds from source without running all the tests?, I'm currently building after my changes using A nvm found a way:
|
@jayconrod I was able to reproduce it!!!, thank you so much for your time and guidance. 😃 I've pushed an update to the project: Basically just clone it and run
The fix for this is basically applying the following patch, after that it builds successfully:
In the case of my source I had a build constraint that looked like this: If not allowing for build constraints to have dashes is the desired behavior I think the documentation should be updated to mention that limitation: If build constraints with dashes are allowed then this would be the bug/issue right?, should a new issue be opened if it's the case? The way I figured it out was because the file that had the constraint with dashes was excluded from adding it's declared imports Basically |
Glad you figured it out. Indeed, dashes are not allowed in build tags. Agreed that the documentation should be updated. |
Change https://golang.org/cl/184917 mentions this issue: |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Tried to build the executable after running
rm -rf $GOPATH/pkg
, I then rango mod download
and tried to do a build:After getting that error message, I ensured that the module is fetched and downloaded:
Then I retried the build:
Same result, so I now tried cleaning the cache:
I've also ran
go mod verify
, and it reports no issues:What did you expect to see?
I expected to see a
core.bin
executable in my current directory.What did you see instead?
I tried to reproduce the issue and to setup a project that mimics the structure of the one that I'm experiencing issues with but it seems to be specific to my setup:
However with such setup I'm able to produce a valid executable:
And it runs correctly:
Is there a way for me to get more information about the specific package that is failing?
The text was updated successfully, but these errors were encountered: