• Dmitriy Dudkin's avatar
    cmd/go: fix go get -u wildcard corner case · 6abc4a7c
    Dmitriy Dudkin authored
    Suppose you have already downloaded "foo.bar/baz", where the repo
    is for all of foo.bar/, and you then "go get -u foo.bar/...".
    The command-line wildcard expands to foo.bar/baz,
    and go get updates the foo.bar/ repo.
    Suppose that the repo update brought in foo.bar/quux,
    though, which depends on other.site/bar.
    Download does not consider foo.bar/quux, since it's
    only looking at foo.bar/baz, so it didn't download other.site/bar.
    After the download, we call importPaths(args) to decide what to install.
    That call was reevaluating the original wildcard with the new repo
    and matching foo.bar/quux, which was missing its dependency
    other.site/bar, causing a build failure.
    
    The fix in this CL is to remember the pre-download expansion
    of the argument list and pass it to the installer. Then only the things
    we tried to download get installed.
    
    The case where foo.bar/ is not even checked out yet continues to work,
    because in that case we leave the wildcard in place, and download
    reevaluates it during the download.
    
    The fix in this CL may not be the right long-term fix, but it is at least a fix.
    It may be that download should be passed all the original wildcards
    so that it can reexpand them as new code is downloaded, ideally reaching
    a fixed point. That can be left for another day.
    
    In short:
    
    - The problem is that the "install" half of "go get" was trying to install
      more than the "download" half was properly downloading.
    - The fix in this CL is to install just what was downloaded (install less).
    - It may be that a future CL should instead download what will be installed (download more).
    
    Fixes #14450.
    
    Change-Id: Ia1984761d24439549b7cff322bc0dbc262c1a653
    Reviewed-on: https://go-review.googlesource.com/19892
    Run-TryBot: Russ Cox <rsc@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    Reviewed-by: 's avatarRuss Cox <rsc@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    6abc4a7c
Name
Last commit
Last update
..
testdata Loading commit data...
alldocs.go Loading commit data...
bootstrap.go Loading commit data...
bug.go Loading commit data...
build.go Loading commit data...
clean.go Loading commit data...
context.go Loading commit data...
discovery.go Loading commit data...
doc.go Loading commit data...
env.go Loading commit data...
fix.go Loading commit data...
fmt.go Loading commit data...
generate.go Loading commit data...
generate_test.go Loading commit data...
get.go Loading commit data...
go11.go Loading commit data...
go_test.go Loading commit data...
go_unix_test.go Loading commit data...
go_windows_test.go Loading commit data...
help.go Loading commit data...
http.go Loading commit data...
list.go Loading commit data...
main.go Loading commit data...
match_test.go Loading commit data...
mkalldocs.sh Loading commit data...
note.go Loading commit data...
note_test.go Loading commit data...
pkg.go Loading commit data...
pkg_test.go Loading commit data...
run.go Loading commit data...
signal.go Loading commit data...
signal_notunix.go Loading commit data...
signal_unix.go Loading commit data...
tag_test.go Loading commit data...
test.go Loading commit data...
testflag.go Loading commit data...
testgo.go Loading commit data...
tool.go Loading commit data...
vcs.go Loading commit data...
vcs_test.go Loading commit data...
vendor_test.go Loading commit data...
version.go Loading commit data...
vet.go Loading commit data...