]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile/internal/big: update and apply vendor.bash
authorRobert Griesemer <gri@golang.org>
Fri, 22 May 2015 22:21:56 +0000 (15:21 -0700)
committerRobert Griesemer <gri@golang.org>
Fri, 22 May 2015 22:46:44 +0000 (22:46 +0000)
Package-external tests must use the vendored math/big package, not
the original one, otherwise tests may fail if there are discrepancies
in the implementation.

Change-Id: Ic5f0489aa6420ffea1f488633453f871ce1f0f66
Reviewed-on: https://go-review.googlesource.com/10380
Reviewed-by: Ian Lance Taylor <iant@golang.org>
src/cmd/compile/internal/big/example_test.go
src/cmd/compile/internal/big/floatexample_test.go
src/cmd/compile/internal/big/vendor.bash

index 078be47f956940d5fed438817a3e0bdc65ab504d..cb91bc23bdfc2f4fa5d49e5381e3d9bc22986cfa 100644 (file)
@@ -5,9 +5,9 @@
 package big_test
 
 import (
+       "cmd/compile/internal/big"
        "fmt"
        "log"
-       "math/big"
 )
 
 func ExampleRat_SetString() {
index 7db10238bc64603004f5bc8c107cd4a7921bff8a..0ac9617c0669b917a08c8a871bbc5f3a38c68ece 100644 (file)
@@ -5,9 +5,9 @@
 package big_test
 
 import (
+       "cmd/compile/internal/big"
        "fmt"
        "math"
-       "math/big"
 )
 
 func ExampleFloat_Add() {
index 84aa750462f5494fef8deda609e26c3cd5a603e9..1b191ccb8fca1e59752584e2284d06127b2fac88 100755 (executable)
@@ -15,9 +15,15 @@ rm *.go
 cp $BIGDIR/*.go .
 
 # Use pure Go arith ops w/o build tag.
-sed 's/^\/\/ \+build math_big_pure_go$//' arith_decl_pure.go > arith_decl.go
+sed 's|^// \+build math_big_pure_go$||' arith_decl_pure.go > arith_decl.go
 rm arith_decl_pure.go
 
+# Import vendored math/big in external tests (e.g., floatexample_test.go).
+for f in *_test.go; do
+       sed 's|"math/big"|"cmd/compile/internal/big"|' $f > foo.go
+       mv foo.go $f
+done
+
 # gofmt to clean up after sed
 gofmt -w .