Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
4c006182
Commit
4c006182
authored
Apr 13, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pkg: manual cleanup of some gofixed code
R=golang-dev, niemeyer, r CC=golang-dev
https://golang.org/cl/4372052
parent
017e73c1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
177 deletions
+138
-177
src/pkg/asn1/asn1.go
src/pkg/asn1/asn1.go
+8
-16
src/pkg/encoding/binary/binary.go
src/pkg/encoding/binary/binary.go
+41
-55
src/pkg/exp/eval/bridge.go
src/pkg/exp/eval/bridge.go
+30
-35
src/pkg/net/dnsmsg.go
src/pkg/net/dnsmsg.go
+29
-38
src/pkg/testing/quick/quick.go
src/pkg/testing/quick/quick.go
+30
-33
No files found.
src/pkg/asn1/asn1.go
View file @
4c006182
...
@@ -467,7 +467,6 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
...
@@ -467,7 +467,6 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
// Deal with the ANY type.
// Deal with the ANY type.
if
ifaceType
:=
fieldType
;
ifaceType
.
Kind
()
==
reflect
.
Interface
&&
ifaceType
.
NumMethod
()
==
0
{
if
ifaceType
:=
fieldType
;
ifaceType
.
Kind
()
==
reflect
.
Interface
&&
ifaceType
.
NumMethod
()
==
0
{
ifaceValue
:=
v
var
t
tagAndLength
var
t
tagAndLength
t
,
offset
,
err
=
parseTagAndLength
(
bytes
,
offset
)
t
,
offset
,
err
=
parseTagAndLength
(
bytes
,
offset
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -506,7 +505,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
...
@@ -506,7 +505,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
return
return
}
}
if
result
!=
nil
{
if
result
!=
nil
{
ifaceValue
.
Set
(
reflect
.
NewValue
(
result
))
v
.
Set
(
reflect
.
NewValue
(
result
))
}
}
return
return
}
}
...
@@ -536,9 +535,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
...
@@ -536,9 +535,7 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
err
=
StructuralError
{
"Zero length explicit tag was not an asn1.Flag"
}
err
=
StructuralError
{
"Zero length explicit tag was not an asn1.Flag"
}
return
return
}
}
v
.
SetBool
(
true
)
flagValue
:=
v
flagValue
.
SetBool
(
true
)
return
return
}
}
}
else
{
}
else
{
...
@@ -606,23 +603,20 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
...
@@ -606,23 +603,20 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
switch
fieldType
{
switch
fieldType
{
case
objectIdentifierType
:
case
objectIdentifierType
:
newSlice
,
err1
:=
parseObjectIdentifier
(
innerBytes
)
newSlice
,
err1
:=
parseObjectIdentifier
(
innerBytes
)
sliceValue
:=
v
v
.
Set
(
reflect
.
MakeSlice
(
v
.
Type
(),
len
(
newSlice
),
len
(
newSlice
)))
sliceValue
.
Set
(
reflect
.
MakeSlice
(
sliceValue
.
Type
(),
len
(
newSlice
),
len
(
newSlice
)))
if
err1
==
nil
{
if
err1
==
nil
{
reflect
.
Copy
(
sliceValue
,
reflect
.
NewValue
(
newSlice
))
reflect
.
Copy
(
v
,
reflect
.
NewValue
(
newSlice
))
}
}
err
=
err1
err
=
err1
return
return
case
bitStringType
:
case
bitStringType
:
structValue
:=
v
bs
,
err1
:=
parseBitString
(
innerBytes
)
bs
,
err1
:=
parseBitString
(
innerBytes
)
if
err1
==
nil
{
if
err1
==
nil
{
structValue
.
Set
(
reflect
.
NewValue
(
bs
))
v
.
Set
(
reflect
.
NewValue
(
bs
))
}
}
err
=
err1
err
=
err1
return
return
case
timeType
:
case
timeType
:
ptrValue
:=
v
var
time
*
time
.
Time
var
time
*
time
.
Time
var
err1
os
.
Error
var
err1
os
.
Error
if
universalTag
==
tagUTCTime
{
if
universalTag
==
tagUTCTime
{
...
@@ -631,21 +625,19 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
...
@@ -631,21 +625,19 @@ func parseField(v reflect.Value, bytes []byte, initOffset int, params fieldParam
time
,
err1
=
parseGeneralizedTime
(
innerBytes
)
time
,
err1
=
parseGeneralizedTime
(
innerBytes
)
}
}
if
err1
==
nil
{
if
err1
==
nil
{
ptrValue
.
Set
(
reflect
.
NewValue
(
time
))
v
.
Set
(
reflect
.
NewValue
(
time
))
}
}
err
=
err1
err
=
err1
return
return
case
enumeratedType
:
case
enumeratedType
:
parsedInt
,
err1
:=
parseInt
(
innerBytes
)
parsedInt
,
err1
:=
parseInt
(
innerBytes
)
enumValue
:=
v
if
err1
==
nil
{
if
err1
==
nil
{
enumValue
.
SetInt
(
int64
(
parsedInt
))
v
.
SetInt
(
int64
(
parsedInt
))
}
}
err
=
err1
err
=
err1
return
return
case
flagType
:
case
flagType
:
flagValue
:=
v
v
.
SetBool
(
true
)
flagValue
.
SetBool
(
true
)
return
return
}
}
switch
val
:=
v
;
val
.
Kind
()
{
switch
val
:=
v
;
val
.
Kind
()
{
...
...
src/pkg/encoding/binary/binary.go
View file @
4c006182
...
@@ -168,18 +168,18 @@ func Write(w io.Writer, order ByteOrder, data interface{}) os.Error {
...
@@ -168,18 +168,18 @@ func Write(w io.Writer, order ByteOrder, data interface{}) os.Error {
}
}
func
TotalSize
(
v
reflect
.
Value
)
int
{
func
TotalSize
(
v
reflect
.
Value
)
int
{
if
sv
:=
v
;
s
v
.
Kind
()
==
reflect
.
Slice
{
if
v
.
Kind
()
==
reflect
.
Slice
{
elem
:=
sizeof
(
v
.
Type
()
.
Elem
())
elem
:=
sizeof
(
v
.
Type
()
.
Elem
())
if
elem
<
0
{
if
elem
<
0
{
return
-
1
return
-
1
}
}
return
s
v
.
Len
()
*
elem
return
v
.
Len
()
*
elem
}
}
return
sizeof
(
v
.
Type
())
return
sizeof
(
v
.
Type
())
}
}
func
sizeof
(
v
reflect
.
Type
)
int
{
func
sizeof
(
t
reflect
.
Type
)
int
{
switch
t
:=
v
;
t
.
Kind
()
{
switch
t
.
Kind
()
{
case
reflect
.
Array
:
case
reflect
.
Array
:
n
:=
sizeof
(
t
.
Elem
())
n
:=
sizeof
(
t
.
Elem
())
if
n
<
0
{
if
n
<
0
{
...
@@ -198,12 +198,10 @@ func sizeof(v reflect.Type) int {
...
@@ -198,12 +198,10 @@ func sizeof(v reflect.Type) int {
}
}
return
sum
return
sum
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
,
reflect
.
Int
,
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
,
reflect
.
Float32
,
reflect
.
Float64
,
reflect
.
Complex64
,
reflect
.
Complex128
:
case
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
switch
t
:=
t
.
Kind
();
t
{
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
,
case
reflect
.
Int
,
reflect
.
Uint
,
reflect
.
Uintptr
:
reflect
.
Float32
,
reflect
.
Float64
,
reflect
.
Complex64
,
reflect
.
Complex128
:
return
-
1
return
int
(
t
.
Size
())
}
return
int
(
v
.
Size
())
}
}
return
-
1
return
-
1
}
}
...
@@ -297,51 +295,39 @@ func (d *decoder) value(v reflect.Value) {
...
@@ -297,51 +295,39 @@ func (d *decoder) value(v reflect.Value) {
d
.
value
(
v
.
Index
(
i
))
d
.
value
(
v
.
Index
(
i
))
}
}
case
reflect
.
Int
,
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
:
case
reflect
.
Int8
:
switch
v
.
Type
()
.
Kind
()
{
v
.
SetInt
(
int64
(
d
.
int8
()))
case
reflect
.
Int8
:
case
reflect
.
Int16
:
v
.
SetInt
(
int64
(
d
.
int8
()))
v
.
SetInt
(
int64
(
d
.
int16
()))
case
reflect
.
Int16
:
case
reflect
.
Int32
:
v
.
SetInt
(
int64
(
d
.
int16
()))
v
.
SetInt
(
int64
(
d
.
int32
()))
case
reflect
.
Int32
:
case
reflect
.
Int64
:
v
.
SetInt
(
int64
(
d
.
int32
()))
v
.
SetInt
(
d
.
int64
())
case
reflect
.
Int64
:
v
.
SetInt
(
d
.
int64
())
case
reflect
.
Uint8
:
}
v
.
SetUint
(
uint64
(
d
.
uint8
()))
case
reflect
.
Uint16
:
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
:
v
.
SetUint
(
uint64
(
d
.
uint16
()))
switch
v
.
Type
()
.
Kind
()
{
case
reflect
.
Uint32
:
case
reflect
.
Uint8
:
v
.
SetUint
(
uint64
(
d
.
uint32
()))
v
.
SetUint
(
uint64
(
d
.
uint8
()))
case
reflect
.
Uint64
:
case
reflect
.
Uint16
:
v
.
SetUint
(
d
.
uint64
())
v
.
SetUint
(
uint64
(
d
.
uint16
()))
case
reflect
.
Uint32
:
case
reflect
.
Float32
:
v
.
SetUint
(
uint64
(
d
.
uint32
()))
v
.
SetFloat
(
float64
(
math
.
Float32frombits
(
d
.
uint32
())))
case
reflect
.
Uint64
:
case
reflect
.
Float64
:
v
.
SetUint
(
d
.
uint64
())
v
.
SetFloat
(
math
.
Float64frombits
(
d
.
uint64
()))
}
case
reflect
.
Complex64
:
case
reflect
.
Float32
,
reflect
.
Float64
:
v
.
SetComplex
(
complex
(
switch
v
.
Type
()
.
Kind
()
{
float64
(
math
.
Float32frombits
(
d
.
uint32
())),
case
reflect
.
Float32
:
float64
(
math
.
Float32frombits
(
d
.
uint32
())),
v
.
SetFloat
(
float64
(
math
.
Float32frombits
(
d
.
uint32
())))
))
case
reflect
.
Float64
:
case
reflect
.
Complex128
:
v
.
SetFloat
(
math
.
Float64frombits
(
d
.
uint64
()))
v
.
SetComplex
(
complex
(
}
math
.
Float64frombits
(
d
.
uint64
()),
math
.
Float64frombits
(
d
.
uint64
()),
case
reflect
.
Complex64
,
reflect
.
Complex128
:
))
switch
v
.
Type
()
.
Kind
()
{
case
reflect
.
Complex64
:
v
.
SetComplex
(
complex
(
float64
(
math
.
Float32frombits
(
d
.
uint32
())),
float64
(
math
.
Float32frombits
(
d
.
uint32
())),
))
case
reflect
.
Complex128
:
v
.
SetComplex
(
complex
(
math
.
Float64frombits
(
d
.
uint64
()),
math
.
Float64frombits
(
d
.
uint64
()),
))
}
}
}
}
}
...
...
src/pkg/exp/eval/bridge.go
View file @
4c006182
...
@@ -37,41 +37,36 @@ func TypeFromNative(t reflect.Type) Type {
...
@@ -37,41 +37,36 @@ func TypeFromNative(t reflect.Type) Type {
switch
t
.
Kind
()
{
switch
t
.
Kind
()
{
case
reflect
.
Bool
:
case
reflect
.
Bool
:
et
=
BoolType
et
=
BoolType
case
reflect
.
Float32
,
reflect
.
Float64
:
switch
t
.
Kind
()
{
case
reflect
.
Float32
:
case
reflect
.
Float32
:
et
=
Float32Type
et
=
Float32Type
case
reflect
.
Float64
:
case
reflect
.
Float64
:
et
=
Float64Type
et
=
Float64Type
}
case
reflect
.
Int16
:
case
reflect
.
Int
,
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
:
et
=
Int16Type
switch
t
.
Kind
()
{
case
reflect
.
Int32
:
case
reflect
.
Int16
:
et
=
Int32Type
et
=
Int16Type
case
reflect
.
Int64
:
case
reflect
.
Int32
:
et
=
Int64Type
et
=
Int32Type
case
reflect
.
Int8
:
case
reflect
.
Int64
:
et
=
Int8Type
et
=
Int64Type
case
reflect
.
Int
:
case
reflect
.
Int8
:
et
=
IntType
et
=
Int8Type
case
reflect
.
Int
:
case
reflect
.
Uint16
:
et
=
IntType
et
=
Uint16Type
}
case
reflect
.
Uint32
:
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
:
et
=
Uint32Type
switch
t
.
Kind
()
{
case
reflect
.
Uint64
:
case
reflect
.
Uint16
:
et
=
Uint64Type
et
=
Uint16Type
case
reflect
.
Uint8
:
case
reflect
.
Uint32
:
et
=
Uint8Type
et
=
Uint32Type
case
reflect
.
Uint
:
case
reflect
.
Uint64
:
et
=
UintType
et
=
Uint64Type
case
reflect
.
Uintptr
:
case
reflect
.
Uint8
:
et
=
UintptrType
et
=
Uint8Type
case
reflect
.
Uint
:
et
=
UintType
case
reflect
.
Uintptr
:
et
=
UintptrType
}
case
reflect
.
String
:
case
reflect
.
String
:
et
=
StringType
et
=
StringType
case
reflect
.
Array
:
case
reflect
.
Array
:
...
...
src/pkg/net/dnsmsg.go
View file @
4c006182
...
@@ -400,28 +400,24 @@ func packStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok bool)
...
@@ -400,28 +400,24 @@ func packStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok bool)
return
len
(
msg
),
false
return
len
(
msg
),
false
case
reflect
.
Struct
:
case
reflect
.
Struct
:
off
,
ok
=
packStructValue
(
fv
,
msg
,
off
)
off
,
ok
=
packStructValue
(
fv
,
msg
,
off
)
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
:
case
reflect
.
Uint16
:
if
off
+
2
>
len
(
msg
)
{
return
len
(
msg
),
false
}
i
:=
fv
.
Uint
()
i
:=
fv
.
Uint
()
switch
fv
.
Type
()
.
Kind
()
{
msg
[
off
]
=
byte
(
i
>>
8
)
default
:
msg
[
off
+
1
]
=
byte
(
i
)
goto
BadType
off
+=
2
case
reflect
.
Uint16
:
case
reflect
.
Uint32
:
if
off
+
2
>
len
(
msg
)
{
if
off
+
4
>
len
(
msg
)
{
return
len
(
msg
),
false
return
len
(
msg
),
false
}
msg
[
off
]
=
byte
(
i
>>
8
)
msg
[
off
+
1
]
=
byte
(
i
)
off
+=
2
case
reflect
.
Uint32
:
if
off
+
4
>
len
(
msg
)
{
return
len
(
msg
),
false
}
msg
[
off
]
=
byte
(
i
>>
24
)
msg
[
off
+
1
]
=
byte
(
i
>>
16
)
msg
[
off
+
2
]
=
byte
(
i
>>
8
)
msg
[
off
+
3
]
=
byte
(
i
)
off
+=
4
}
}
i
:=
fv
.
Uint
()
msg
[
off
]
=
byte
(
i
>>
24
)
msg
[
off
+
1
]
=
byte
(
i
>>
16
)
msg
[
off
+
2
]
=
byte
(
i
>>
8
)
msg
[
off
+
3
]
=
byte
(
i
)
off
+=
4
case
reflect
.
Array
:
case
reflect
.
Array
:
if
fv
.
Type
()
.
Elem
()
.
Kind
()
!=
reflect
.
Uint8
{
if
fv
.
Type
()
.
Elem
()
.
Kind
()
!=
reflect
.
Uint8
{
goto
BadType
goto
BadType
...
@@ -481,25 +477,20 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
...
@@ -481,25 +477,20 @@ func unpackStructValue(val reflect.Value, msg []byte, off int) (off1 int, ok boo
return
len
(
msg
),
false
return
len
(
msg
),
false
case
reflect
.
Struct
:
case
reflect
.
Struct
:
off
,
ok
=
unpackStructValue
(
fv
,
msg
,
off
)
off
,
ok
=
unpackStructValue
(
fv
,
msg
,
off
)
case
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
:
case
reflect
.
Uint16
:
switch
fv
.
Type
()
.
Kind
()
{
if
off
+
2
>
len
(
msg
)
{
default
:
return
len
(
msg
),
false
goto
BadType
}
case
reflect
.
Uint16
:
i
:=
uint16
(
msg
[
off
])
<<
8
|
uint16
(
msg
[
off
+
1
])
if
off
+
2
>
len
(
msg
)
{
fv
.
SetUint
(
uint64
(
i
))
return
len
(
msg
),
false
off
+=
2
}
case
reflect
.
Uint32
:
i
:=
uint16
(
msg
[
off
])
<<
8
|
uint16
(
msg
[
off
+
1
])
if
off
+
4
>
len
(
msg
)
{
fv
.
SetUint
(
uint64
(
i
))
return
len
(
msg
),
false
off
+=
2
case
reflect
.
Uint32
:
if
off
+
4
>
len
(
msg
)
{
return
len
(
msg
),
false
}
i
:=
uint32
(
msg
[
off
])
<<
24
|
uint32
(
msg
[
off
+
1
])
<<
16
|
uint32
(
msg
[
off
+
2
])
<<
8
|
uint32
(
msg
[
off
+
3
])
fv
.
SetUint
(
uint64
(
i
))
off
+=
4
}
}
i
:=
uint32
(
msg
[
off
])
<<
24
|
uint32
(
msg
[
off
+
1
])
<<
16
|
uint32
(
msg
[
off
+
2
])
<<
8
|
uint32
(
msg
[
off
+
3
])
fv
.
SetUint
(
uint64
(
i
))
off
+=
4
case
reflect
.
Array
:
case
reflect
.
Array
:
if
fv
.
Type
()
.
Elem
()
.
Kind
()
!=
reflect
.
Uint8
{
if
fv
.
Type
()
.
Elem
()
.
Kind
()
!=
reflect
.
Uint8
{
goto
BadType
goto
BadType
...
...
src/pkg/testing/quick/quick.go
View file @
4c006182
...
@@ -60,39 +60,36 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) {
...
@@ -60,39 +60,36 @@ func Value(t reflect.Type, rand *rand.Rand) (value reflect.Value, ok bool) {
switch
concrete
:=
t
;
concrete
.
Kind
()
{
switch
concrete
:=
t
;
concrete
.
Kind
()
{
case
reflect
.
Bool
:
case
reflect
.
Bool
:
return
reflect
.
NewValue
(
rand
.
Int
()
&
1
==
0
),
true
return
reflect
.
NewValue
(
rand
.
Int
()
&
1
==
0
),
true
case
reflect
.
Float32
,
reflect
.
Float64
,
reflect
.
Int
,
reflect
.
Int8
,
reflect
.
Int16
,
reflect
.
Int32
,
reflect
.
Int64
,
reflect
.
Uint
,
reflect
.
Uint8
,
reflect
.
Uint16
,
reflect
.
Uint32
,
reflect
.
Uint64
,
reflect
.
Uintptr
,
reflect
.
Complex64
,
reflect
.
Complex128
:
case
reflect
.
Float32
:
switch
t
.
Kind
()
{
return
reflect
.
NewValue
(
randFloat32
(
rand
)),
true
case
reflect
.
Float32
:
case
reflect
.
Float64
:
return
reflect
.
NewValue
(
randFloat32
(
rand
)),
true
return
reflect
.
NewValue
(
randFloat64
(
rand
)),
true
case
reflect
.
Float64
:
case
reflect
.
Complex64
:
return
reflect
.
NewValue
(
randFloat64
(
rand
)),
true
return
reflect
.
NewValue
(
complex
(
randFloat32
(
rand
),
randFloat32
(
rand
))),
true
case
reflect
.
Complex64
:
case
reflect
.
Complex128
:
return
reflect
.
NewValue
(
complex
(
randFloat32
(
rand
),
randFloat32
(
rand
))),
true
return
reflect
.
NewValue
(
complex
(
randFloat64
(
rand
),
randFloat64
(
rand
))),
true
case
reflect
.
Complex128
:
case
reflect
.
Int16
:
return
reflect
.
NewValue
(
complex
(
randFloat64
(
rand
),
randFloat64
(
rand
))),
true
return
reflect
.
NewValue
(
int16
(
randInt64
(
rand
))),
true
case
reflect
.
Int16
:
case
reflect
.
Int32
:
return
reflect
.
NewValue
(
int16
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
int32
(
randInt64
(
rand
))),
true
case
reflect
.
Int32
:
case
reflect
.
Int64
:
return
reflect
.
NewValue
(
int32
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
randInt64
(
rand
)),
true
case
reflect
.
Int64
:
case
reflect
.
Int8
:
return
reflect
.
NewValue
(
randInt64
(
rand
)),
true
return
reflect
.
NewValue
(
int8
(
randInt64
(
rand
))),
true
case
reflect
.
Int8
:
case
reflect
.
Int
:
return
reflect
.
NewValue
(
int8
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
int
(
randInt64
(
rand
))),
true
case
reflect
.
Int
:
case
reflect
.
Uint16
:
return
reflect
.
NewValue
(
int
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
uint16
(
randInt64
(
rand
))),
true
case
reflect
.
Uint16
:
case
reflect
.
Uint32
:
return
reflect
.
NewValue
(
uint16
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
uint32
(
randInt64
(
rand
))),
true
case
reflect
.
Uint32
:
case
reflect
.
Uint64
:
return
reflect
.
NewValue
(
uint32
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
uint64
(
randInt64
(
rand
))),
true
case
reflect
.
Uint64
:
case
reflect
.
Uint8
:
return
reflect
.
NewValue
(
uint64
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
uint8
(
randInt64
(
rand
))),
true
case
reflect
.
Uint8
:
case
reflect
.
Uint
:
return
reflect
.
NewValue
(
uint8
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
uint
(
randInt64
(
rand
))),
true
case
reflect
.
Uint
:
case
reflect
.
Uintptr
:
return
reflect
.
NewValue
(
uint
(
randInt64
(
rand
))),
true
return
reflect
.
NewValue
(
uintptr
(
randInt64
(
rand
))),
true
case
reflect
.
Uintptr
:
return
reflect
.
NewValue
(
uintptr
(
randInt64
(
rand
))),
true
}
case
reflect
.
Map
:
case
reflect
.
Map
:
numElems
:=
rand
.
Intn
(
complexSize
)
numElems
:=
rand
.
Intn
(
complexSize
)
m
:=
reflect
.
MakeMap
(
concrete
)
m
:=
reflect
.
MakeMap
(
concrete
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment