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

x/vgo: vgo list fails if there are no source files #25712

Closed
myitcv opened this issue Jun 3, 2018 · 3 comments
Closed

x/vgo: vgo list fails if there are no source files #25712

myitcv opened this issue Jun 3, 2018 · 3 comments
Milestone

Comments

@myitcv
Copy link
Member

myitcv commented Jun 3, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.2 linux/amd64
go version devel +06b326054d Sat Jun 2 18:00:44 2018 +0000 linux/amd64

vgo version:

$ (command cd $(go list -f "{{.Dir}}" golang.org/x/vgo); git rev-parse HEAD)
7c0cf33f39ccf5d8e4c59d34a150425ddac7df6a

Does this issue reproduce with the latest release?

Yes, and tip.

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

GOARCH="amd64"
GOBIN=""
GOCACHE="/home/myitcv/.cache/go-build"
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/tmp/tmp.08BtAFjstf"
GOPROXY=""
GORACE=""
GOROOT="/home/myitcv/gos"
GOTMPDIR=""
GOTOOLDIR="/home/myitcv/gos/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build089678844=/tmp/go-build -gno-record-gcc-switches"
VGOMODROOT=""

What did you do?

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

cd `mktemp -d`
export GOPATH=$PWD
mkdir hello
cd hello
cat <<EOD > go.mod
module example.com/hello
EOD
vgo list .

What did you expect to see?

Something like:

{
        "Module": {
                "Top": true,
                "Path": "example.com/hello",
                "Version": ""
        }
}

What did you see instead?

vgo: import "example.com/hello" [/tmp/tmp.08BtAFjstf/hello]: no Go source files

As I understand it, there is no requirement for a Go module to contain source code; it could just be a parent of submodules.

I wonder whether this issue could/should be broadened to be "fully define semantics of vgo list" to include:

  • the fact vgo list should work where there are no source files
  • vgo list -t, or some super-powers version of it, should give one the ability to list versions across all major version numbers (because otherwise I need to know the latest major version number to do vgo list -t example.com/hello/vX
  • adding the -deps and -test flags from tip
  • whether vgo list should ever create a go.mod if it doesn't exist
  • whether vgo list should have a mode which doesn't try to do any resolution/downloading and instead errors in case something doesn't fully resolve, so that tools depending on its output don't block for potentially long periods of time, or barf on non-JSON output
  • .... others?
@gopherbot gopherbot added this to the vgo milestone Jun 3, 2018
@myitcv
Copy link
Member Author

myitcv commented Jun 3, 2018

@rsc
Copy link
Contributor

rsc commented Jun 6, 2018

"vgo list" is about packages and will remain so (remember, it will be "go list").
If there is no package in the current directory, complaining about that fact is correct. Note that vgo list -m . at the end of your script would work fine.

That said, there certainly are commands that are not about packages that complain incorrectly about "no Go source files" and we should fix them. That's not unique to list.

Let's make different issues for different list considerations.
#25656 is for list -t.
#25162 is for list and go.mod creation.
#24066 is for list's use of the network.

I think that covers everything raised here, so I am going to close this issue.

@rsc rsc closed this as completed Jun 6, 2018
@myitcv
Copy link
Member Author

myitcv commented Jun 6, 2018

Makes sense, thanks.

@golang golang locked and limited conversation to collaborators Jun 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants