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: could not import github.com/robteix/testmod/v2 (no package data for import path github.com/robteix/testmod/v2) #34204

Closed
chingiz2387 opened this issue Sep 10, 2019 · 6 comments

Comments

@chingiz2387
Copy link

@chingiz2387 chingiz2387 commented Sep 10, 2019

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

$ go version
go version go1.12.9 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

go env Output
$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\00046605\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=D:\myProject\Go\
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=0
set GOMOD=D:\myProject\Go\src\github.com\EPAY2\oauth\go.mod
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=-m64 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\00046605\AppData\Local\Temp\go-build124838294=/tmp/go-build -gno-record-gcc-switches

What did you do?

Hello everyone, when connecting the modules to the golang project, I install the module through the get-go and specify the path in the import test mode "github.com/robteix/testmod/v2"

What did you expect to see?

import (
testmode "github.com/robteix/testmod/v2"
)

to see a working import without errors

What did you see instead?

could not import github.com/robteix/testmod/v2 (no package data for import path github.com/robteix/testmod/v2)

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 10, 2019

Note that the go.mod file in the v2.0.0 release has a mismatched module path. (It declares its path to be github.com/rselbach/testmod/v2, but you are importing it as github.com/robteix/testmod/v2.)

In general, Go 1.13 should produce much clearer diagnostics in this sort of case. Please try this with a go1.13 build and let us know if things are still unclear.

@bcmills bcmills changed the title could not import github.com/robteix/testmod/v2 (no package data for import path github.com/robteix/testmod/v2) cmd/go: could not import github.com/robteix/testmod/v2 (no package data for import path github.com/robteix/testmod/v2) Sep 10, 2019
@hyangah

This comment has been minimized.

Copy link
Contributor

@hyangah hyangah commented Sep 10, 2019

I hope the following error message with go1.13 is clear enough to help users find the issue @chingiz2387

$ go get github.com/robteix/testmod/v2
go get: github.com/robteix/testmod/v2@v2.0.0: parsing go.mod:
	module declares its path as: github.com/rselbach/testmod/v2
	        but was required as: github.com/robteix/testmod/v2
@chingiz2387

This comment has been minimized.

Copy link
Author

@chingiz2387 chingiz2387 commented Sep 11, 2019

@bcmills Hello, сan you explain in more detail "Note that the go.mod file in the v2.0.0 release has a mismatched module path. (It declares its path to be github.com/rselbach/testmod/v2, but you are importing it as github.com/robteix/testmod/v2.)" in go.mod i see that it is installed by github.com/robteix/testmod/v2 v2.0.0 or i misunderstood you...

@hyangah

This comment has been minimized.

Copy link
Contributor

@hyangah hyangah commented Sep 11, 2019

@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Sep 11, 2019

As far as I can tell the go command is working as designed here, and the diagnostic seems to have gotten much clearer in Go 1.13. I don't see anything left to do, so closing this issue.

@bcmills bcmills closed this Sep 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.