- Notifications
You must be signed in to change notification settings - Fork329
Rewrite with compression support#163
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes from1 commit
8604dee
e55ac18
e142e08
53c1aea
2cf6c28
a01afea
531d4fa
d0a8049
dd107dd
6c6b8e9
6b782a3
989ba2f
9f15963
120911b
7ad1514
746140b
43cb01e
e8dfe27
f6137f3
6f6fa43
8c87970
aaf4b45
6b76536
0f115ed
b6b56b7
9e32354
78da35e
d092686
6975801
bbaf469
faadcc9
3f2589f
b53f306
69ff675
085e671
51769b3
670be05
988b8f2
3a526d8
999b812
4b84d25
85f249d
6b38ebb
6770421
c752365
0ea9466
b33d48c
9c5bfab
3673c2c
c5b0a00
1c7c14e
503b469
dff4af3
2377cca
d57b253
1bc100d
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
<!-- | ||
Please be as descriptive as possible. | ||
--> |
This file was deleted.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -5,7 +5,6 @@ import ( | ||
"encoding/binary" | ||
"math" | ||
"math/bits" | ||
) | ||
// opcode represents a WebSocket opcode. | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
package assert | ||
import ( | ||
"github.com/google/go-cmp/cmp" | ||
"reflect" | ||
) | ||
// https://github.com/google/go-cmp/issues/40#issuecomment-328615283 | ||
func cmpDiff(exp, act interface{}) string { | ||
return cmp.Diff(exp, act, deepAllowUnexported(exp, act)) | ||
} | ||
func deepAllowUnexported(vs ...interface{}) cmp.Option { | ||
m := make(map[reflect.Type]struct{}) | ||
for _, v := range vs { | ||
structTypes(reflect.ValueOf(v), m) | ||
} | ||
var typs []interface{} | ||
for t := range m { | ||
typs = append(typs, reflect.New(t).Elem().Interface()) | ||
} | ||
return cmp.AllowUnexported(typs...) | ||
} | ||
func structTypes(v reflect.Value, m map[reflect.Type]struct{}) { | ||
if !v.IsValid() { | ||
return | ||
} | ||
switch v.Kind() { | ||
case reflect.Ptr: | ||
if !v.IsNil() { | ||
structTypes(v.Elem(), m) | ||
} | ||
case reflect.Interface: | ||
if !v.IsNil() { | ||
structTypes(v.Elem(), m) | ||
} | ||
case reflect.Slice, reflect.Array: | ||
for i := 0; i < v.Len(); i++ { | ||
structTypes(v.Index(i), m) | ||
} | ||
case reflect.Map: | ||
for _, k := range v.MapKeys() { | ||
structTypes(v.MapIndex(k), m) | ||
} | ||
case reflect.Struct: | ||
m[v.Type()] = struct{}{} | ||
for i := 0; i < v.NumField(); i++ { | ||
structTypes(v.Field(i), m) | ||
} | ||
} | ||
} |
Uh oh!
There was an error while loading.Please reload this page.