diff options
author | Russ Cox <rsc@golang.org> | 2012-04-26 14:25:28 -0400 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2012-04-26 14:25:28 -0400 |
commit | 923d0a63c38cf0faaa10c62d80dfe559e2f669d3 (patch) | |
tree | ff25b2f0814f991c33eda78b203bad38bcc5b807 /src/cmd/go/get.go | |
parent | 5a74588caa47bc9a1c5f3d33ae4c9f542c7b0ccf (diff) | |
download | go-923d0a63c38cf0faaa10c62d80dfe559e2f669d3.tar.gz |
cmd/go: new tag selection logic
The new logic is "use go1 if it's there, otherwise no tag."
Nothing needs to say "I require go1.0.1", and I want to
preserve some flexibility in defining what tags mean.
Right now (before go1.0.1) there is only one possible tag,
"go1", and I'd like to keep it that way.
R=golang-dev, bradfitz, r, adg
CC=golang-dev
http://codereview.appspot.com/6112060
Diffstat (limited to 'src/cmd/go/get.go')
-rw-r--r-- | src/cmd/go/get.go | 64 |
1 files changed, 20 insertions, 44 deletions
diff --git a/src/cmd/go/get.go b/src/cmd/go/get.go index 97a6d8dc7..fe45697e2 100644 --- a/src/cmd/go/get.go +++ b/src/cmd/go/get.go @@ -335,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 |