• Jay Conrod's avatar
    cmd/go: avoid accidental downgrades in 'go get' with latest and patch · 4c2ffd26
    Jay Conrod authored
    Currently, 'go get -u' and 'go get -u=patch' avoid accidentally
    downgrading modules by preventing upgrades in two cases:
    
    1) If the current version is a prerelease that is semantically later
       than the "latest" or "patch" version.
    2) If the current version is a pseudoversion that is chronologically
       newer than the "latest" or "patch" version.
    
    With this change, 'go get m@latest' and 'go get m@patch' prevent
    downgrades using the same checks.
    
    Also: 'go get m@patch' now works if m is a module path but not a
    package path (i.e., there is no package in the module root directory).
    
    Fixes #30634
    Fixes #32537
    
    Change-Id: I916630c385b5f3ba7c13e0d65ba08f73a1a67829
    Reviewed-on: https://go-review.googlesource.com/c/go/+/180337
    Run-TryBot: Jay Conrod <jayconrod@google.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarBryan C. Mills <bcmills@google.com>
    4c2ffd26
query_test.go 6.75 KB