summaryrefslogtreecommitdiff
path: root/src/cmd/go/get.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/cmd/go/get.go')
-rw-r--r--src/cmd/go/get.go78
1 files changed, 25 insertions, 53 deletions
diff --git a/src/cmd/go/get.go b/src/cmd/go/get.go
index f70b6761d..fe45697e2 100644
--- a/src/cmd/go/get.go
+++ b/src/cmd/go/get.go
@@ -37,15 +37,11 @@ The -u flag instructs get to use the network to update the named packages
and their dependencies. By default, get uses the network to check out
missing packages but does not use it to look for updates to existing packages.
-When checking out or updating a package, get looks for a branch or
-tag that matches the locally installed version of Go. If the local
-version "is release.rNN", it searches for "go.rNN". (For an
-installation using Go version "weekly.YYYY-MM-DD", it searches for a
-package version labeled "go.YYYY-MM-DD".) If the desired version
-cannot be found but others exist with labels in the correct format,
-get retrieves the most recent version before the desired label.
-Finally, if all else fails it retrieves the most recent version of
-the package.
+When checking out or updating a package, get looks for a branch or tag
+that matches the locally installed version of Go. The most important
+rule is that if the local installation is running version "go1", get
+searches for a branch or tag named "go1". If no such version exists it
+retrieves the most recent version of the package.
For more about specifying packages, see 'go help packages'.
@@ -339,56 +335,32 @@ var goTag = regexp.MustCompile(
// Version "goX" (or "goX.Y" or "goX.Y.Z") matches tags of the same form.
// Version "release.rN" matches tags of the form "go.rN" (N being a floating-point number).
// Version "weekly.YYYY-MM-DD" matches tags like "go.weekly.YYYY-MM-DD".
+//
+// NOTE(rsc): Eventually we will need to decide on some logic here.
+// For now, there is only "go1". This matches the docs in go help get.
func selectTag(goVersion string, tags []string) (match string) {
- const rPrefix = "release.r"
- if strings.HasPrefix(goVersion, rPrefix) {
- p := "go.r"
- v, err := strconv.ParseFloat(goVersion[len(rPrefix):], 64)
- if err != nil {
- return ""
- }
- var matchf float64
- for _, t := range tags {
- if !strings.HasPrefix(t, p) {
- continue
- }
- tf, err := strconv.ParseFloat(t[len(p):], 64)
- if err != nil {
- continue
- }
- if matchf < tf && tf <= v {
- match, matchf = t, tf
- }
+ for _, t := range tags {
+ if t == "go1" {
+ return "go1"
}
}
-
- const wPrefix = "weekly."
- if strings.HasPrefix(goVersion, wPrefix) {
- p := "go.weekly."
- v := goVersion[len(wPrefix):]
- for _, t := range tags {
- if !strings.HasPrefix(t, p) {
- continue
- }
- if match < t && t[len(p):] <= v {
- match = t
- }
- }
- }
-
- if goTag.MatchString(goVersion) {
- v := goVersion
- for _, t := range tags {
- if !goTag.MatchString(t) {
- continue
- }
- if cmpGoVersion(match, t) < 0 && cmpGoVersion(t, v) <= 0 {
- match = t
+ return ""
+
+ /*
+ if goTag.MatchString(goVersion) {
+ v := goVersion
+ for _, t := range tags {
+ if !goTag.MatchString(t) {
+ continue
+ }
+ if cmpGoVersion(match, t) < 0 && cmpGoVersion(t, v) <= 0 {
+ match = t
+ }
}
}
- }
- return match
+ return match
+ */
}
// cmpGoVersion returns -1, 0, +1 reporting whether