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: Dir property missing from list -m -json output in replace directives #26216

Closed
dlsniper opened this issue Jul 4, 2018 · 2 comments
Closed
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@dlsniper
Copy link
Contributor

dlsniper commented Jul 4, 2018

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

vgo @ 6cd5a417451d8ee907692eded07ef1b6b53825b1

Does this issue reproduce with the latest release?

yes

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

Windows 10/amd64

What did you do?

Using the following example project: https://github.com/dlsniper/vgoawesomeProject I changed the go.mod file with the following content

module vgoawesomeProject

require github.com/dlsniper/vgodemo v1.0.0

replace github.com/dlsniper/vgodemo v1.0.0 => github.com/dlsniper/vgodemo v0.0.0-20180318080540-4356961a9

Then I ran vgo list -m -json all.

What did you expect to see?

vgo: finding github.com/dlsniper/vgodemo v0.0.0-20180704102233-4356961a96dc
{
        "Path": "vgoawesomeProject",
        "Main": true
}
{
        "Path": "github.com/dlsniper/vgodemo",
        "Version": "v1.0.0",
        "Replace": {
                "Path": "github.com/dlsniper/vgodemo",
                "Version": "v0.0.0-20180704102233-4356961a96dc",
                "Time": "2018-07-04T10:22:33Z",
                "Dir": "D:\\go\\src\\mod\\github.com\\dlsniper\\vgodemo@v0.0.0-20180704102233-4356961a96dc"
        },
        "Time": "2018-07-04T10:22:33Z"
}
{
        "Path": "github.com/gorilla/mux",
        "Version": "v1.6.2",
        "Time": "2018-05-13T03:22:33Z",
        "Dir": "D:\\go\\src\\mod\\github.com\\gorilla\\mux@v1.6.2"
}

What did you see instead?

vgo: finding github.com/dlsniper/vgodemo v0.0.0-20180704102233-4356961a96dc
{
        "Path": "vgoawesomeProject",
        "Main": true
}
{
        "Path": "github.com/dlsniper/vgodemo",
        "Version": "v1.0.0",
        "Replace": {
                "Path": "github.com/dlsniper/vgodemo",
                "Version": "v0.0.0-20180704102233-4356961a96dc",
                "Time": "2018-07-04T10:22:33Z"
        },
        "Time": "2018-07-04T10:22:33Z"
}
{
        "Path": "github.com/gorilla/mux",
        "Version": "v1.6.2",
        "Time": "2018-05-13T03:22:33Z",
        "Dir": "D:\\go\\src\\mod\\github.com\\gorilla\\mux@v1.6.2"
}
@gopherbot gopherbot added this to the vgo milestone Jul 4, 2018
@bcmills
Copy link
Contributor

bcmills commented Jul 4, 2018

The Dir field is only set if the source code has actually been downloaded. What happens if you do a vgo build . before the vgo list -m -json all?

@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Jul 4, 2018
@rsc
Copy link
Contributor

rsc commented Jul 6, 2018

I can reproduce this with an empty GOPATH cache:

$ git clone https://github.com/dlsniper/vgoawesomeProject
Cloning into 'vgoawesomeProject'...
remote: Counting objects: 12, done.        
remote: Compressing objects:  10% (1/10)           
remote: Compressing objects: 100% (10/10), done.        
remote: Total 12 (delta 0), reused 12 (delta 0), pack-reused 0        
Unpacking objects:   8% (1/12)   
Unpacking objects:  16% (2/12)   
Unpacking objects:  33% (4/12)   
Unpacking objects:  66% (8/12)   
Unpacking objects: 100% (12/12)   
Unpacking objects: 100% (12/12), done.
$ cd vgoawesome*
$ ls
go.mod	go.sum	main.go	subpkg
$ cat go.mod
module vgoawesomeProject

require github.com/dlsniper/vgodemo v1.0.0

replace github.com/dlsniper/vgodemo v1.0.0 => github.com/dlsniper/vgodemo v0.0.0-20180704102233-4356961a96dc
$ vgo list -m -json all
go: finding github.com/dlsniper/vgodemo v0.0.0-20180704102233-4356961a96dc
go: finding github.com/gorilla/mux v1.6.2
go: finding github.com/dlsniper/vgodemo v1.0.0
{
	"Path": "vgoawesomeProject",
	"Main": true,
	"Dir": "/tmp/vgoawesomeProject"
}
{
	"Path": "github.com/dlsniper/vgodemo",
	"Version": "v1.0.0",
	"Replace": {
		"Path": "github.com/dlsniper/vgodemo",
		"Version": "v0.0.0-20180704102233-4356961a96dc",
		"Time": "2018-07-04T10:22:33Z"
	},
	"Time": "2018-07-04T10:22:33Z"
}
{
	"Path": "github.com/gorilla/mux",
	"Version": "v1.6.2",
	"Time": "2018-05-13T03:22:33Z",
	"Indirect": true
}
$

But then populating the cache by asking the go command to analyze all the packages in the top-level module pages in the extra modules, and then the Dirs appear:

$ vgo list all >/dev/null
go: downloading github.com/dlsniper/vgodemo v0.0.0-20180704102233-4356961a96dc
go: downloading github.com/gorilla/mux v1.6.2
$ vgo list -m -json all
{
	"Path": "vgoawesomeProject",
	"Main": true,
	"Dir": "/tmp/vgoawesomeProject"
}
{
	"Path": "github.com/dlsniper/vgodemo",
	"Version": "v1.0.0",
	"Replace": {
		"Path": "github.com/dlsniper/vgodemo",
		"Version": "v0.0.0-20180704102233-4356961a96dc",
		"Time": "2018-07-04T10:22:33Z",
		"Dir": "/Users/rsc/src/mod/github.com/dlsniper/vgodemo@v0.0.0-20180704102233-4356961a96dc"
	},
	"Time": "2018-07-04T10:22:33Z",
	"Dir": "/Users/rsc/src/mod/github.com/dlsniper/vgodemo@v0.0.0-20180704102233-4356961a96dc"
}
{
	"Path": "github.com/gorilla/mux",
	"Version": "v1.6.2",
	"Time": "2018-05-13T03:22:33Z",
	"Indirect": true,
	"Dir": "/Users/rsc/src/mod/github.com/gorilla/mux@v1.6.2"
}
$ 

It's possible one of my pending changes is the fix, but I don't think so - I think the cache just didn't have the code tree available in the run in the original report.

@rsc rsc closed this as completed Jul 6, 2018
@golang golang locked and limited conversation to collaborators Jul 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

4 participants