File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package tezgen
22
33import (
44 "encoding/hex"
5- "errors"
65 "math/big"
76 "strconv"
87 "time"
@@ -120,15 +119,20 @@ func NewInt(val int64) Int {
120119// UnmarshalJSON -
121120func (i * Int ) UnmarshalJSON (data []byte ) error {
122121 if i .Int == nil {
123- return errors .New ("nil Int value" )
122+ i .Int = big .NewInt (0 )
123+ }
124+ if len (data ) > 2 {
125+ if data [0 ] == '"' && data [len (data )- 1 ] == '"' {
126+ data = data [1 : len (data )- 1 ]
127+ }
124128 }
125129 return i .Int .UnmarshalJSON (data )
126130}
127131
128132// MarshalJSON -
129133func (i Int ) MarshalJSON () ([]byte , error ) {
130134 if i .Int == nil {
131- return nil , errors . New ( "nil Int value" )
135+ i . Int = big . NewInt ( 0 )
132136 }
133137 return i .Int .MarshalJSON ()
134138}
You can’t perform that action at this time.
0 commit comments