mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-20 08:27:29 +08:00
refactor: if statement (#10105)
This commit is contained in:
@ -234,10 +234,10 @@ Specification of CAR formats: https://ipld.io/specs/transport/car/
|
|||||||
|
|
||||||
if event.Root.PinErrorMsg != "" {
|
if event.Root.PinErrorMsg != "" {
|
||||||
return fmt.Errorf("pinning root %q FAILED: %s", enc.Encode(event.Root.Cid), event.Root.PinErrorMsg)
|
return fmt.Errorf("pinning root %q FAILED: %s", enc.Encode(event.Root.Cid), event.Root.PinErrorMsg)
|
||||||
} else {
|
|
||||||
event.Root.PinErrorMsg = "success"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event.Root.PinErrorMsg = "success"
|
||||||
|
|
||||||
_, err = fmt.Fprintf(
|
_, err = fmt.Fprintf(
|
||||||
w,
|
w,
|
||||||
"Pinned root\t%s\t%s\n",
|
"Pinned root\t%s\t%s\n",
|
||||||
|
@ -51,11 +51,10 @@ func TestCheckVersionOption(t *testing.T) {
|
|||||||
called = true
|
called = true
|
||||||
if !tc.shouldHandle {
|
if !tc.shouldHandle {
|
||||||
t.Error("handler was called even though version didn't match")
|
t.Error("handler was called even though version didn't match")
|
||||||
} else {
|
}
|
||||||
if _, err := io.WriteString(w, "check!"); err != nil {
|
if _, err := io.WriteString(w, "check!"); err != nil {
|
||||||
t.Error(err)
|
t.Error(err)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
w := httptest.NewRecorder()
|
w := httptest.NewRecorder()
|
||||||
|
@ -100,11 +100,10 @@ func (it *peerChanIter) Next() bool {
|
|||||||
if ok {
|
if ok {
|
||||||
it.next = &addr
|
it.next = &addr
|
||||||
return true
|
return true
|
||||||
} else {
|
}
|
||||||
it.next = nil
|
it.next = nil
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (it *peerChanIter) Val() types.Record {
|
func (it *peerChanIter) Val() types.Record {
|
||||||
if it.next == nil {
|
if it.next == nil {
|
||||||
|
@ -38,7 +38,7 @@ func makeSmuxTransportOption(tptConfig config.Transports) (libp2p.Option, error)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return libp2p.ChainOptions(opts...), nil
|
return libp2p.ChainOptions(opts...), nil
|
||||||
} else {
|
}
|
||||||
return prioritizeOptions([]priorityOption{{
|
return prioritizeOptions([]priorityOption{{
|
||||||
priority: tptConfig.Multiplexers.Yamux,
|
priority: tptConfig.Multiplexers.Yamux,
|
||||||
defaultPriority: 100,
|
defaultPriority: 100,
|
||||||
@ -49,7 +49,6 @@ func makeSmuxTransportOption(tptConfig config.Transports) (libp2p.Option, error)
|
|||||||
opt: libp2p.Muxer(mplex.ID, mplex.DefaultTransport),
|
opt: libp2p.Muxer(mplex.ID, mplex.DefaultTransport),
|
||||||
}}), nil
|
}}), nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error) {
|
func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error) {
|
||||||
return func() (opts Libp2pOpts, err error) {
|
return func() (opts Libp2pOpts, err error) {
|
||||||
|
@ -141,9 +141,8 @@ func darwinFuseCheckVersion(node *core.IpfsNode) error {
|
|||||||
return err
|
return err
|
||||||
} else if skip {
|
} else if skip {
|
||||||
return nil // user told us not to check version... ok....
|
return nil // user told us not to check version... ok....
|
||||||
} else {
|
|
||||||
return errGFV
|
|
||||||
}
|
}
|
||||||
|
return errGFV
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug("mount: osxfuse version:", ov)
|
log.Debug("mount: osxfuse version:", ov)
|
||||||
|
Reference in New Issue
Block a user