summaryrefslogtreecommitdiff
path: root/src/cmd/pack
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2014-02-19 15:33:47 -0800
committerRob Pike <r@golang.org>2014-02-19 15:33:47 -0800
commitcc9cdca403c98275ec72523bdf4294619639d4a2 (patch)
treed62eb3cf7705768f2c70ac4bb1169033a8f7ca6f /src/cmd/pack
parent1c742268022071fda6609de3368beaa81b85cd51 (diff)
downloadgo-cc9cdca403c98275ec72523bdf4294619639d4a2.tar.gz
cmd/pack: don't look for " in output from go env
Windows at least doesn't emit one. Maybe fix Windows build. LGTM=bradfitz R=bradfitz CC=golang-codereviews https://codereview.appspot.com/66120046
Diffstat (limited to 'src/cmd/pack')
-rw-r--r--src/cmd/pack/pack_test.go12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/cmd/pack/pack_test.go b/src/cmd/pack/pack_test.go
index a073fa452..cab236fa8 100644
--- a/src/cmd/pack/pack_test.go
+++ b/src/cmd/pack/pack_test.go
@@ -12,7 +12,7 @@ import (
"os"
"os/exec"
"path/filepath"
- "strings"
+ "regexp"
"testing"
"time"
"unicode/utf8"
@@ -193,11 +193,15 @@ func TestHello(t *testing.T) {
}
out := run("go", "env")
- i := strings.Index(out, "GOCHAR=\"")
- if i < 0 {
+ re, err := regexp.Compile(`\s*GOCHAR="?(\w)"?`)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fields := re.FindStringSubmatch(out)
+ if fields == nil {
t.Fatal("cannot find GOCHAR in 'go env' output:\n", out)
}
- char := out[i+8 : i+9]
+ char := fields[1]
run("go", "build", "cmd/pack") // writes pack binary to dir
run("go", "tool", char+"g", "hello.go")
run("./pack", "grc", "hello.a", "hello."+char)