Skip to content

Commit

Permalink
Merge pull request #410 from grishy/main
Browse files Browse the repository at this point in the history
Docs sync Arith schema and code
  • Loading branch information
zenhack authored Dec 30, 2022
2 parents 7eaf071 + 3d08b5b commit 5a5e462
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/Remote-Procedure-Calls-using-Interfaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ $Go.import("arith");
# Declare the Arith capability, which provides multiplication and division.
interface Arith {
multiply @0 (a :Int64, b :Int64) -> (:product :Int64);
multiply @0 (a :Int64, b :Int64) -> (product :Int64);
divide @1 (num :Int64, denom :Int64) -> (quo :Int64, rem :Int64);
}
```
Expand Down Expand Up @@ -112,7 +112,7 @@ func (Arith) Multiply(ctx context.Context, call Arith_multiply) error {
// Divide is analogous to Multiply. All capability server methods follow the
// same pattern.
func (Arith) Divide(ctx context.Context, call Arith_divide) error {
if call.Args().B() == 0 {
if call.Args().Denom() == 0 {
return errors.New("divide by zero")
}

Expand All @@ -121,8 +121,8 @@ func (Arith) Divide(ctx context.Context, call Arith_divide) error {
return err
}

res.SetQuo(call.Args().A() / call.Args().B())
res.SetRem(call.Args().A() % call.Args().B())
res.SetQuo(call.Args().Num() / call.Args().Denom())
res.SetRem(call.Args().Num() % call.Args().Denom())
return nil
}
```
Expand Down

0 comments on commit 5a5e462

Please sign in to comment.