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: Import "github.com/abcd/xyz" is a program, not an importable package. #23483

Closed
nikhilagrawal577 opened this issue Jan 19, 2018 · 3 comments
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@nikhilagrawal577
Copy link

Please answer these questions before submitting your issue. Thanks!

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

go version go1.9.2 windows/amd64

Does this issue reproduce with the latest release?

Yes

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

set GOARCH=amd64
set GOBIN=
set GOEXE=.exe
set GOHOSTARCH=amd64set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\ABC\go
set GORACE=
set GOROOT=C:\Go
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0
set CXX=g++
set CGO_ENABLED=1
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

What did you do?

I am trying to execute "GO TEST" in a folder where source code and test files are present.
I am using ginkgo here.

I found few people facing this error because "a non-main package cant import main package".
i made both as main package. Still getting this same error.

If possible, provide a recipe for reproducing the error.
A complete runnable program is good.
A link on play.golang.org is best.

What did you expect to see?

Result of Test cases

What did you see instead?

import "github.com/abcd/xyz" is a program, not an importable package.

@mvdan
Copy link
Member

mvdan commented Jan 19, 2018

This bug report is lacking a way to reproduce the issue.

The problem here is likely because the package you're testing is importing a main package. The fix here is not to make both package main packages. The fix is to not import a main package, ever.

@mvdan mvdan added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Jan 19, 2018
@nikhilagrawal577
Copy link
Author

@mvdan I tried changing the name of the package (different than main).
If its a non-main package, it should be imported. But in my case, i got the same error.

@mvdan
Copy link
Member

mvdan commented Jan 22, 2018

This is still lacking a way to reproduce the issue. I suggest you take this to one of the forums or mailing lists: https://github.com/golang/go/wiki/Questions

It can always be brought back as an issue in the tracker if you think this is a bug in Go. But without a way to tell or reproduce, this seems like a question more than a bug.

@mvdan mvdan closed this as completed Jan 22, 2018
@mikioh mikioh changed the title Import "github.com/abcd/xyz" is a program, not an importable package. cmd/go: Import "github.com/abcd/xyz" is a program, not an importable package. Jan 26, 2018
@golang golang locked and limited conversation to collaborators Jan 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants