Skip to content

Commit

Permalink
jsonpb: use CheckInitialized
Browse files Browse the repository at this point in the history
Change-Id: Id2ba5826577960f283a90a766435353e6399c060
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220687
Reviewed-by: Damien Neil <[email protected]>
  • Loading branch information
dsnet committed Feb 25, 2020
1 parent ad065b8 commit 97960cd
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ go 1.9

require (
github.com/google/go-cmp v0.4.0
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64
google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100
)
4 changes: 3 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64 h1:BhpvsYSxWvxATQJYrD9UKX1U3jo+Bxq195IzJGtyh40=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100 h1:i1uRQ2Eod1FWX6jGO/l8K0oMIwtCWeEmeDtLy5YABYc=
google.golang.org/protobuf v0.0.0-20200224223749-2dabbe471100/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
2 changes: 1 addition & 1 deletion jsonpb/decode.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ func (u *Unmarshaler) UnmarshalNext(d *json.Decoder, m proto.Message) error {
if err := u.unmarshalMessage(mr, raw); err != nil {
return err
}
return protoV2.IsInitialized(mr.Interface())
return protoV2.CheckInitialized(mr.Interface())
}
}

Expand Down
2 changes: 1 addition & 1 deletion jsonpb/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ func (jm *Marshaler) marshal(m proto.Message) ([]byte, error) {
} else {
// Check for unpopulated required fields first.
m2 := protoimpl.X.MessageOf(m)
if err := protoV2.IsInitialized(m2.Interface()); err != nil {
if err := protoV2.CheckInitialized(m2.Interface()); err != nil {
return nil, err
}

Expand Down

0 comments on commit 97960cd

Please sign in to comment.