Skip to content
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: generate a better error message for imports of nonexistent non-module paths #35734

Closed
RahulKandagatla opened this issue Nov 21, 2019 · 4 comments
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@RahulKandagatla
Copy link

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

$ go version
1.13

Does this issue reproduce with the latest release?

I dont know

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

go env Output
$ go env

set GO111MODULE=
set GOARCH=386
set GOBIN=
set GOCACHE=C:\Users\RAHUL\AppData\Local\go-build
set GOENV=C:\Users\RAHUL\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=386
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=E:\go-work
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_386
set GCCGO=gccgo
set GO386=sse2
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m32 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\RAHUL\AppData\Local\Temp\go-build469851946=/tmp/go-build -gno-record-gcc-switches

What did you do?

$go mod init github.com/xxxx

$go build

What did you expect to see?

a builld of my project

What did you see instead?

build github.com/xxxx: cannot load xxxx/models: malformed module path "xxxx/models": missing dot in first path element

@ALTree
Copy link
Member

ALTree commented Nov 21, 2019

Probably a dup of #35273. Can you try with the current tip (soon to be 1.14)? It should print a better error (if your actually in the same situation described in #35273).

@ALTree ALTree added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 21, 2019
@bcmills
Copy link
Contributor

bcmills commented Dec 6, 2019

This has the same underlying cause as #34769.

@bcmills bcmills added the NeedsFix The path to resolution is known, but the work has not been done. label Dec 6, 2019
@bcmills bcmills changed the title malformed module path "xxxx/models": missing dot in first path element cmd/go: generate a better error message for imports of nonexistent non-module paths Dec 6, 2019
@bcmills bcmills added the modules label Dec 6, 2019
@bcmills bcmills self-assigned this Dec 6, 2019
@bcmills bcmills added this to the Go1.14 milestone Dec 6, 2019
@bcmills bcmills removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Dec 6, 2019
@gopherbot
Copy link

Change https://golang.org/cl/210339 mentions this issue: cmd/go: avoid generating "malformed module path" errors for standard-library paths

@gopherbot
Copy link

Change https://golang.org/cl/216817 mentions this issue: go/build: update TestImportDirNotExist to accept more detailed error strings

gopherbot pushed a commit that referenced this issue Jan 29, 2020
…strings

In CL 203820, we switched go/build to use the caller's working
directory for the main module (rather than srcDir), so that go/build
resolution now respects the requirements and replacements of the main
module. When the passed-in srcDir is empty, as of that CL we use "go
list" instead of falling back to in-process (GOPATH-mode) path lookup.

Unfortunately, that broke go/build.TestImportDirNotExist when
GO111MODULE=on: the test was looking for the specific error message
produced by the in-process lookup.

This change relaxes the test to accept the error message produced by
"go list" when srcDir is empty.

Updates #34769
Updates #34860
Updates #35734
Fixes #36867

Change-Id: Id0f7814a4b7dabe8917216eb013bb4eaee283648
Reviewed-on: https://go-review.googlesource.com/c/go/+/216817
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
@golang golang locked and limited conversation to collaborators Jan 28, 2021
@rsc rsc unassigned bcmills Jun 23, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge modules NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

4 participants