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
Assignees
Labels
Milestone

Comments

@RahulKandagatla
Copy link

@RahulKandagatla RahulKandagatla commented Nov 21, 2019

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

This comment has been minimized.

Copy link
Member

@ALTree 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).

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Dec 6, 2019

This has the same underlying cause as #34769.

@bcmills bcmills added the NeedsFix 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 label Dec 6, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Dec 6, 2019

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

@gopherbot gopherbot closed this in 1de3131 Dec 6, 2019
@gopherbot

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Jan 29, 2020

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.