mirror of
https://github.com/ipfs/kubo.git
synced 2025-05-17 06:57:40 +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 != "" {
|
||||
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(
|
||||
w,
|
||||
"Pinned root\t%s\t%s\n",
|
||||
|
@ -51,10 +51,9 @@ func TestCheckVersionOption(t *testing.T) {
|
||||
called = true
|
||||
if !tc.shouldHandle {
|
||||
t.Error("handler was called even though version didn't match")
|
||||
} else {
|
||||
if _, err := io.WriteString(w, "check!"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
}
|
||||
if _, err := io.WriteString(w, "check!"); err != nil {
|
||||
t.Error(err)
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -100,10 +100,9 @@ func (it *peerChanIter) Next() bool {
|
||||
if ok {
|
||||
it.next = &addr
|
||||
return true
|
||||
} else {
|
||||
it.next = nil
|
||||
return false
|
||||
}
|
||||
it.next = nil
|
||||
return false
|
||||
}
|
||||
|
||||
func (it *peerChanIter) Val() types.Record {
|
||||
|
@ -38,17 +38,16 @@ func makeSmuxTransportOption(tptConfig config.Transports) (libp2p.Option, error)
|
||||
}
|
||||
}
|
||||
return libp2p.ChainOptions(opts...), nil
|
||||
} else {
|
||||
return prioritizeOptions([]priorityOption{{
|
||||
priority: tptConfig.Multiplexers.Yamux,
|
||||
defaultPriority: 100,
|
||||
opt: libp2p.Muxer(yamux.ID, yamux.DefaultTransport),
|
||||
}, {
|
||||
priority: tptConfig.Multiplexers.Mplex,
|
||||
defaultPriority: config.Disabled,
|
||||
opt: libp2p.Muxer(mplex.ID, mplex.DefaultTransport),
|
||||
}}), nil
|
||||
}
|
||||
return prioritizeOptions([]priorityOption{{
|
||||
priority: tptConfig.Multiplexers.Yamux,
|
||||
defaultPriority: 100,
|
||||
opt: libp2p.Muxer(yamux.ID, yamux.DefaultTransport),
|
||||
}, {
|
||||
priority: tptConfig.Multiplexers.Mplex,
|
||||
defaultPriority: config.Disabled,
|
||||
opt: libp2p.Muxer(mplex.ID, mplex.DefaultTransport),
|
||||
}}), nil
|
||||
}
|
||||
|
||||
func SmuxTransport(tptConfig config.Transports) func() (opts Libp2pOpts, err error) {
|
||||
|
@ -141,9 +141,8 @@ func darwinFuseCheckVersion(node *core.IpfsNode) error {
|
||||
return err
|
||||
} else if skip {
|
||||
return nil // user told us not to check version... ok....
|
||||
} else {
|
||||
return errGFV
|
||||
}
|
||||
return errGFV
|
||||
}
|
||||
|
||||
log.Debug("mount: osxfuse version:", ov)
|
||||
|
Reference in New Issue
Block a user