-
Notifications
You must be signed in to change notification settings - Fork 570
Go 1.8 support (version bump to GopherJS 1.8-1). #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0ff5023
bc37a63
01f15b4
ead0eba
65cbe62
4a9226b
e6dec35
e3c80b5
b10af79
5e896be
3303ee8
40ff6ca
a362c44
12846d3
8980111
ad3bc12
0c82c68
b36bf38
1d7ed2c
16fddcc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// +build js | ||
|
||
package driver | ||
|
||
var valueConverterTests = []valueConverterTest{ | ||
{Bool, "true", true, ""}, | ||
{Bool, "True", true, ""}, | ||
{Bool, []byte("t"), true, ""}, | ||
{Bool, true, true, ""}, | ||
{Bool, "1", true, ""}, | ||
{Bool, 1, true, ""}, | ||
{Bool, int64(1), true, ""}, | ||
{Bool, uint16(1), true, ""}, | ||
{Bool, "false", false, ""}, | ||
{Bool, false, false, ""}, | ||
{Bool, "0", false, ""}, | ||
{Bool, 0, false, ""}, | ||
{Bool, int64(0), false, ""}, | ||
{Bool, uint16(0), false, ""}, | ||
{c: Bool, in: "foo", err: "sql/driver: couldn't convert \"foo\" into type bool"}, | ||
{c: Bool, in: 2, err: "sql/driver: couldn't convert 2 into type bool"}, | ||
{DefaultParameterConverter, now, now, ""}, | ||
{DefaultParameterConverter, (*int64)(nil), nil, ""}, | ||
{DefaultParameterConverter, &answer, answer, ""}, | ||
{DefaultParameterConverter, &now, now, ""}, | ||
//{DefaultParameterConverter, i(9), int64(9), ""}, // TODO: Fix. | ||
{DefaultParameterConverter, f(0.1), float64(0.1), ""}, | ||
{DefaultParameterConverter, b(true), true, ""}, | ||
//{DefaultParameterConverter, bs{1}, []byte{1}, ""}, // TODO: Fix. | ||
{DefaultParameterConverter, s("a"), "a", ""}, | ||
{DefaultParameterConverter, is{1}, nil, "unsupported type driver.is, a slice of int"}, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// +build js | ||
|
||
package testenv | ||
|
||
import ( | ||
"runtime" | ||
"strings" | ||
) | ||
|
||
// HasExec reports whether the current system can start new processes | ||
// using os.StartProcess or (more commonly) exec.Command. | ||
func HasExec() bool { | ||
switch runtime.GOOS { | ||
case "nacl": | ||
return false | ||
case "darwin": | ||
if strings.HasPrefix(runtime.GOARCH, "arm") { | ||
return false | ||
} | ||
} | ||
switch runtime.GOARCH { | ||
case "js": | ||
return false | ||
} | ||
return true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// +build js | ||
|
||
package math_test | ||
|
||
// Slighly higher tolerances than upstream, otherwise TestGamma fails. | ||
// TODO: Is there a better way to fix TestGamma? It's weird that only one test | ||
// requires increasing tolerances. Perhaps there's a better fix? Maybe we | ||
// should override TestGamma specifically and not the package-wide tolerances, | ||
// because this will cause many other tests to be less accurate. Or maybe this | ||
// is fine? | ||
func close(a, b float64) bool { return tolerance(a, b, 4e-14) } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still wondering where exactly we're losing precision. I guess it is because we're using some JS native math functions which are implemented slightly differently than the Go ones. Investigate? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any idea what's going on here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Made #589 to track this. |
||
func veryclose(a, b float64) bool { return tolerance(a, b, 6e-15) } |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// +build js | ||
|
||
package reflect | ||
|
||
func Swapper(slice interface{}) func(i, j int) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this is to enable the new way of sorting in 1.8. |
||
v := ValueOf(slice) | ||
if v.Kind() != Slice { | ||
panic(&ValueError{Method: "Swapper", Kind: v.Kind()}) | ||
} | ||
// Fast path for slices of size 0 and 1. Nothing to swap. | ||
switch v.Len() { | ||
case 0: | ||
return func(i, j int) { panic("reflect: slice index out of range") } | ||
case 1: | ||
return func(i, j int) { | ||
if i != 0 || j != 0 { | ||
panic("reflect: slice index out of range") | ||
} | ||
} | ||
} | ||
tmp := New(v.Type().Elem()).Elem() | ||
return func(i, j int) { | ||
v1 := v.Index(i) | ||
v2 := v.Index(j) | ||
tmp.Set(v1) | ||
v1.Set(v2) | ||
v2.Set(tmp) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
// +build !go1.8 | ||
// +build go1.7 | ||
// +build !go1.9 | ||
// +build go1.8 | ||
|
||
package compiler | ||
|
||
const ___GOPHERJS_REQUIRES_GO_VERSION_1_7___ = true | ||
const ___GOPHERJS_REQUIRES_GO_VERSION_1_8___ = true | ||
|
||
// Version is the GopherJS compiler version string. | ||
const Version = "1.7-1" | ||
const Version = "1.8-1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yey.