diff options
| author | Shulhan <ms@kilabit.info> | 2021-04-23 13:12:08 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2021-04-23 13:12:08 +0700 |
| commit | c0dbddb12e8e41c77d52ca2dd84a2e7e2968179b (patch) | |
| tree | 94f742b7c88f7954a7a26011b60798d7f760f7dc | |
| parent | aff8a206c06e39a010ab90d88f41ae78d7a127f3 (diff) | |
| download | pakakeh.go-c0dbddb12e8e41c77d52ca2dd84a2e7e2968179b.tar.xz | |
math/big: use consistent receiver name for Int methods
| -rw-r--r-- | lib/math/big/int.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/math/big/int.go b/lib/math/big/int.go index 66d5588b..c4cb0289 100644 --- a/lib/math/big/int.go +++ b/lib/math/big/int.go @@ -40,12 +40,12 @@ func NewInt(v interface{}) (i *Int) { // If the global variable MarshalJSONAsString is true, the Int value will // be encoded as string. // -func (r *Int) MarshalJSON() ([]byte, error) { +func (i *Int) MarshalJSON() ([]byte, error) { var s string - if r == nil { + if i == nil { s = "0" } else { - s = r.String() + s = i.String() } if MarshalJSONAsString { s = `"` + s + `"` @@ -56,10 +56,10 @@ func (r *Int) MarshalJSON() ([]byte, error) { // // UnmarshalJSON convert the JSON byte value into Int. // -func (r *Int) UnmarshalJSON(in []byte) (err error) { +func (i *Int) UnmarshalJSON(in []byte) (err error) { in = bytes.Trim(in, `"`) - r.SetInt64(0) - _, ok := r.Int.SetString(string(in), 10) + i.SetInt64(0) + _, ok := i.Int.SetString(string(in), 10) if !ok { return fmt.Errorf("Int.UnmarshalJSON: cannot convert %T(%v) to Int", in, in) } |
