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 mod support for -f and .Dir in -json output #26044

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

Comments

@myitcv
Copy link
Member

commented Jun 25, 2018

Please answer these questions before submitting your issue. Thanks!

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

go version go1.10.3 linux/amd64
vgo commit 0f3e556044ecbd8a0805d098e52a743a1d0e3566

Does this issue reproduce with the latest release?

Yes

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.7KXsauqfrA"
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-build223819470=/tmp/go-build -gno-record-gcc-switches"

What did you do?

cd `mktemp -d`
export GOPATH=$PWD
mkdir hello
cd hello
vgo mod -init -module example.com/hello
vgo mod -json

What did you expect to see?

{
        "Module": {
                "Path": "example.com/hello",
                "Version": "",
                "Dir": "/tmp/tmp.7KXsauqfrA/hello"
        },
        "Require": null,
        "Exclude": null,
        "Replace": null
}

What did you see instead?

{
        "Module": {
                "Path": "example.com/hello",
                "Version": ""
        },
        "Require": null,
        "Exclude": null,
        "Replace": null
}

Having .Dir be part of the output of vgo mod -json would allow other tools to use vgo mod to resolve the containing directory of a module (context). Correspondingly, having a -f flag (equivalent of (v)go list -f) would be useful to programatically extract values returned from -json, including .Module.Dir.

/cc @rsc @bcmills

@gopherbot gopherbot added this to the vgo milestone Jun 25, 2018

@bcmills

This comment has been minimized.

Copy link
Member

commented Jun 26, 2018

Does the list -m -json and list -m -f support in https://golang.org/cl/120198 do what you need?

@myitcv

This comment has been minimized.

Copy link
Member Author

commented Jun 26, 2018

I don't think so - that only gives me (building on the example above):

$ vgo list -m -json
{
        "Path": "example.com/hello",
        "Main": true
}

which looks to be a "subset" of the output from vgo mod -json?

@gopherbot

This comment has been minimized.

Copy link

commented Jul 6, 2018

Change https://golang.org/cl/122398 mentions this issue: cmd/go/internal/modlist: test list -m -f={{.Dir}}

@golang golang locked and limited conversation to collaborators Jul 12, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
3 participants
You can’t perform that action at this time.