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
8a8fd87e
Commit
8a8fd87e
authored
Dec 21, 2017
by
keks
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove dead code (TeeEmitter)
parent
42ab7a16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
71 deletions
+0
-71
teeemitter.go
teeemitter.go
+0
-71
No files found.
teeemitter.go
deleted
100644 → 0
View file @
42ab7a16
package
cmds
import
(
"github.com/ipfs/go-ipfs-cmdkit"
)
// NewTeeEmitter creates a new ResponseEmitter.
// Writing to it will write to both the passed ResponseEmitters.
func
NewTeeEmitter
(
re1
,
re2
ResponseEmitter
)
ResponseEmitter
{
return
&
teeEmitter
{
re1
,
re2
}
}
type
teeEmitter
struct
{
ResponseEmitter
re
ResponseEmitter
}
func
(
re
*
teeEmitter
)
Close
()
error
{
err1
:=
re
.
ResponseEmitter
.
Close
()
err2
:=
re
.
re
.
Close
()
if
err1
!=
nil
{
return
err1
}
// XXX we drop the second error if both fail
return
err2
}
func
(
re
*
teeEmitter
)
Emit
(
v
interface
{})
error
{
err1
:=
re
.
ResponseEmitter
.
Emit
(
v
)
err2
:=
re
.
re
.
Emit
(
v
)
if
err1
!=
nil
{
return
err1
}
// XXX we drop the second error if both fail
return
err2
}
func
(
re
*
teeEmitter
)
SetLength
(
l
uint64
)
{
re
.
ResponseEmitter
.
SetLength
(
l
)
re
.
re
.
SetLength
(
l
)
}
func
(
re
*
teeEmitter
)
SetError
(
err
interface
{},
code
cmdkit
.
ErrorType
)
{
re
.
ResponseEmitter
.
SetError
(
err
,
code
)
re
.
re
.
SetError
(
err
,
code
)
}
type
TeeError
struct
{
err1
,
err2
error
}
func
(
err
TeeError
)
BothNil
()
bool
{
return
err
.
err1
==
nil
&&
err
.
err2
==
nil
}
func
(
err
TeeError
)
Error
()
string
{
if
err
.
err1
!=
nil
&&
err
.
err2
!=
nil
{
return
"1: "
+
err
.
err1
.
Error
()
+
"
\n
2: "
+
err
.
err2
.
Error
()
}
else
if
err
.
err1
!=
nil
{
return
"1: "
+
err
.
err1
.
Error
()
}
else
if
err
.
err2
!=
nil
{
return
"2: "
+
err
.
err2
.
Error
()
}
else
{
return
""
}
}
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