Skip to content

Commit 1893d3b

Browse files
committed
cmd/compile/internal/big: update and apply vendor.bash
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 <[email protected]>
1 parent 75250a9 commit 1893d3b

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

src/cmd/compile/internal/big/example_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
package big_test
66

77
import (
8+
"cmd/compile/internal/big"
89
"fmt"
910
"log"
10-
"math/big"
1111
)
1212

1313
func ExampleRat_SetString() {

src/cmd/compile/internal/big/floatexample_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
package big_test
66

77
import (
8+
"cmd/compile/internal/big"
89
"fmt"
910
"math"
10-
"math/big"
1111
)
1212

1313
func ExampleFloat_Add() {

src/cmd/compile/internal/big/vendor.bash

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,15 @@ rm *.go
1515
cp $BIGDIR/*.go .
1616

1717
# Use pure Go arith ops w/o build tag.
18-
sed 's/^\/\/ \+build math_big_pure_go$//' arith_decl_pure.go > arith_decl.go
18+
sed 's|^// \+build math_big_pure_go$||' arith_decl_pure.go > arith_decl.go
1919
rm arith_decl_pure.go
2020

21+
# Import vendored math/big in external tests (e.g., floatexample_test.go).
22+
for f in *_test.go; do
23+
sed 's|"math/big"|"cmd/compile/internal/big"|' $f > foo.go
24+
mv foo.go $f
25+
done
26+
2127
# gofmt to clean up after sed
2228
gofmt -w .
2329

0 commit comments

Comments
 (0)