]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: restore behavior of branchtag
authorMarvin Stenger <marvin.stenger94@gmail.com>
Sun, 3 Sep 2017 17:58:01 +0000 (19:58 +0200)
committerIan Lance Taylor <iant@golang.org>
Sat, 9 Sep 2017 10:13:38 +0000 (10:13 +0000)
The behavior was changed unintentionally during the conversion from C to Go.
Reviewed-on: https://go-review.googlesource.com/2470

This belongs to a series of clean-up changes (see below) for cmd/dist.
This is change (2).

These changes include:
(1)  apply minor fixes
(2)  restore behavior of branchtag
(3)  unleash bootstrap optimization for windows
(4)  use standard generated code header
(5)  remove trivial variables + functions
(6)  move functions for the better
(7)  simplify code segments
(8)  use bytes.Buffer for code generation
(9)  rename variables + functions
(10) remove doc.go

Change-Id: I53373c7211b35ed68da485c55e510871bfb81267
Reviewed-on: https://go-review.googlesource.com/61022
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/dist/build.go

index 76e42a4b6abbe3733094d8986aff9ad7970cd00e..fa8492c7b3bfb9508682ee5550a0f0aa7c599db7 100644 (file)
@@ -253,7 +253,7 @@ func chomp(s string) string {
 func branchtag(branch string) (tag string, precise bool) {
        b := run(goroot, CheckExit, "git", "log", "--decorate=full", "--format=format:%d", "master.."+branch)
        tag = branch
-       for _, line := range splitlines(b) {
+       for row, line := range splitlines(b) {
                // Each line is either blank, or looks like
                //        (tag: refs/tags/go1.4rc2, refs/remotes/origin/release-branch.go1.4, refs/heads/release-branch.go1.4)
                // We need to find an element starting with refs/tags/.
@@ -271,7 +271,7 @@ func branchtag(branch string) (tag string, precise bool) {
                        continue // malformed line; ignore it
                }
                tag = line[i : i+j]
-               if i == 0 {
+               if row == 0 {
                        precise = true // tag denotes HEAD
                }
                break