Skip to content

malformed module path "xxx": missing dot in first path element - When path itself is missing #35343

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

Closed
spekary opened this issue Nov 4, 2019 · 3 comments
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@spekary
Copy link

spekary commented Nov 4, 2019

Per issue #34184, this is a specific case that causes this error.

What version of Go are you using (go version)?

v1.13.4

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Mac OS 10.14.6

What did you do?

I ran a test on code that had an import path like so:

import mypath/dir/subdir

This code is supposed to be run in a directory that has a go.mod file with a "replace" statement that directs "mypath" to a real directory on the computer, as in:

replace mypath/dir/subdir => ../myproject

However, I did not set that up yet in the go.mod file. Essentially this means that Go was trying to import a path that it could not resolve.

More specifically, here are reproducible steps:

  1. Create a test directory
  2. In the test directory, put the following files:

main.go:

package main
import "a/b/c"

go.mod:

module b
go 1.13
  1. From the test directory, run go run main.go

What did you expect to see?

Since I like errors that offer solutions when available, I like this:

malformed module path "a/b/c": Cannot resolve module path to a directory location. Either install the module, or use a replace statement in a go.mod file to direct it to a location on your disk.

What did you see instead?

cannot load a/b/c: malformed module path "a/b/c": missing dot in first path element

@FiloSottile
Copy link
Contributor

/cc @bcmills @jayconrod

@FiloSottile FiloSottile added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Nov 5, 2019
@FiloSottile FiloSottile added this to the Unplanned milestone Nov 5, 2019
@jayconrod
Copy link
Contributor

I believe this is a duplicate of #35273.

@bcmills
Copy link
Contributor

bcmills commented Nov 6, 2019

Duplicate of #35273

@bcmills bcmills marked this as a duplicate of #35273 Nov 6, 2019
@golang golang locked and limited conversation to collaborators Nov 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants