Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-cmds
Commits
00436dd2
Commit
00436dd2
authored
Jan 10, 2018
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add a bit more type checking
parent
458c45db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
0 deletions
+5
-0
encoding.go
encoding.go
+5
-0
No files found.
encoding.go
View file @
00436dd2
...
...
@@ -85,6 +85,11 @@ func MakeTypedEncoder(f interface{}) func(*Request) func(io.Writer) Encoder {
panic
(
"MakeTypedEncoder must return an error"
)
}
writerInt
:=
reflect
.
TypeOf
((
*
io
.
Writer
)(
nil
))
.
Elem
()
if
t
.
In
(
0
)
!=
reflect
.
TypeOf
(
&
Request
{})
||
!
t
.
In
(
1
)
.
Implements
(
writerInt
)
{
panic
(
"MakeTypedEncoder must receive a function matching func(*Request, io.Writer, ...)"
)
}
valType
:=
t
.
In
(
2
)
return
MakeEncoder
(
func
(
req
*
Request
,
w
io
.
Writer
,
i
interface
{})
error
{
...
...
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