Skip to content

Commit

Permalink
refactor: if statement (#10105)
Browse files Browse the repository at this point in the history
  • Loading branch information
kehiy authored Sep 5, 2023
1 parent 3e5e91d commit 2c66ea6
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
7 changes: 3 additions & 4 deletions core/corehttp/option_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
})

Expand Down
5 changes: 2 additions & 3 deletions core/corehttp/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
19 changes: 9 additions & 10 deletions core/node/libp2p/smux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions fuse/node/mount_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 2c66ea6

Please sign in to comment.