remove omitemptys from generated golang code

This commit is contained in:
Alex Grintsvayg 2019-12-28 16:44:37 -05:00
parent 5ab4c9c726
commit 05a22073b4
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5
4 changed files with 76 additions and 74 deletions

View file

@ -29,3 +29,5 @@ find $DIR/go $DIR/python $DIR/js $DIR/cpp -type f -delete
protoc --proto_path="$DIR/proto" --python_out="$DIR/python" --go_out="$DIR/go" --js_out="import_style=commonjs,binary:$DIR/js" --cpp_out="$DIR/cpp" $DIR/proto/*.proto
ls "$DIR"/go/*.pb.go | xargs -n1 -IX bash -c "sed -e 's/,omitempty//' X > X.tmp && mv X{.tmp,}"

View file

@ -2928,12 +2928,12 @@ type Claim struct {
// *Claim_Collection
// *Claim_Repost
Type isClaim_Type `protobuf_oneof:"type"`
Title string `protobuf:"bytes,8,opt,name=title,proto3" json:"title,omitempty"`
Description string `protobuf:"bytes,9,opt,name=description,proto3" json:"description,omitempty"`
Thumbnail *Source `protobuf:"bytes,10,opt,name=thumbnail,proto3" json:"thumbnail,omitempty"`
Tags []string `protobuf:"bytes,11,rep,name=tags,proto3" json:"tags,omitempty"`
Languages []*Language `protobuf:"bytes,12,rep,name=languages,proto3" json:"languages,omitempty"`
Locations []*Location `protobuf:"bytes,13,rep,name=locations,proto3" json:"locations,omitempty"`
Title string `protobuf:"bytes,8,opt,name=title,proto3" json:"title"`
Description string `protobuf:"bytes,9,opt,name=description,proto3" json:"description"`
Thumbnail *Source `protobuf:"bytes,10,opt,name=thumbnail,proto3" json:"thumbnail"`
Tags []string `protobuf:"bytes,11,rep,name=tags,proto3" json:"tags"`
Languages []*Language `protobuf:"bytes,12,rep,name=languages,proto3" json:"languages"`
Locations []*Location `protobuf:"bytes,13,rep,name=locations,proto3" json:"locations"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3080,12 +3080,12 @@ func (*Claim) XXX_OneofWrappers() []interface{} {
}
type Stream struct {
Source *Source `protobuf:"bytes,1,opt,name=source,proto3" json:"source,omitempty"`
Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author,omitempty"`
License string `protobuf:"bytes,3,opt,name=license,proto3" json:"license,omitempty"`
LicenseUrl string `protobuf:"bytes,4,opt,name=license_url,json=licenseUrl,proto3" json:"license_url,omitempty"`
ReleaseTime int64 `protobuf:"varint,5,opt,name=release_time,json=releaseTime,proto3" json:"release_time,omitempty"`
Fee *Fee `protobuf:"bytes,6,opt,name=fee,proto3" json:"fee,omitempty"`
Source *Source `protobuf:"bytes,1,opt,name=source,proto3" json:"source"`
Author string `protobuf:"bytes,2,opt,name=author,proto3" json:"author"`
License string `protobuf:"bytes,3,opt,name=license,proto3" json:"license"`
LicenseUrl string `protobuf:"bytes,4,opt,name=license_url,json=licenseUrl,proto3" json:"license_url"`
ReleaseTime int64 `protobuf:"varint,5,opt,name=release_time,json=releaseTime,proto3" json:"release_time"`
Fee *Fee `protobuf:"bytes,6,opt,name=fee,proto3" json:"fee"`
// Types that are valid to be assigned to Type:
// *Stream_Image
// *Stream_Video
@ -3238,11 +3238,11 @@ func (*Stream) XXX_OneofWrappers() []interface{} {
}
type Channel struct {
PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"`
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
WebsiteUrl string `protobuf:"bytes,3,opt,name=website_url,json=websiteUrl,proto3" json:"website_url,omitempty"`
Cover *Source `protobuf:"bytes,4,opt,name=cover,proto3" json:"cover,omitempty"`
Featured *ClaimList `protobuf:"bytes,5,opt,name=featured,proto3" json:"featured,omitempty"`
PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key"`
Email string `protobuf:"bytes,2,opt,name=email,proto3" json:"email"`
WebsiteUrl string `protobuf:"bytes,3,opt,name=website_url,json=websiteUrl,proto3" json:"website_url"`
Cover *Source `protobuf:"bytes,4,opt,name=cover,proto3" json:"cover"`
Featured *ClaimList `protobuf:"bytes,5,opt,name=featured,proto3" json:"featured"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3309,7 +3309,7 @@ func (m *Channel) GetFeatured() *ClaimList {
}
type ClaimReference struct {
ClaimHash []byte `protobuf:"bytes,1,opt,name=claim_hash,json=claimHash,proto3" json:"claim_hash,omitempty"`
ClaimHash []byte `protobuf:"bytes,1,opt,name=claim_hash,json=claimHash,proto3" json:"claim_hash"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3348,8 +3348,8 @@ func (m *ClaimReference) GetClaimHash() []byte {
}
type ClaimList struct {
ListType ClaimList_ListType `protobuf:"varint,1,opt,name=list_type,json=listType,proto3,enum=pb.ClaimList_ListType" json:"list_type,omitempty"`
ClaimReferences []*ClaimReference `protobuf:"bytes,2,rep,name=claim_references,json=claimReferences,proto3" json:"claim_references,omitempty"`
ListType ClaimList_ListType `protobuf:"varint,1,opt,name=list_type,json=listType,proto3,enum=pb.ClaimList_ListType" json:"list_type"`
ClaimReferences []*ClaimReference `protobuf:"bytes,2,rep,name=claim_references,json=claimReferences,proto3" json:"claim_references"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3395,13 +3395,13 @@ func (m *ClaimList) GetClaimReferences() []*ClaimReference {
}
type Source struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"`
Size uint64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
MediaType string `protobuf:"bytes,4,opt,name=media_type,json=mediaType,proto3" json:"media_type,omitempty"`
Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"`
SdHash []byte `protobuf:"bytes,6,opt,name=sd_hash,json=sdHash,proto3" json:"sd_hash,omitempty"`
BtInfohash []byte `protobuf:"bytes,7,opt,name=bt_infohash,json=btInfohash,proto3" json:"bt_infohash,omitempty"`
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash"`
Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"`
Size uint64 `protobuf:"varint,3,opt,name=size,proto3" json:"size"`
MediaType string `protobuf:"bytes,4,opt,name=media_type,json=mediaType,proto3" json:"media_type"`
Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url"`
SdHash []byte `protobuf:"bytes,6,opt,name=sd_hash,json=sdHash,proto3" json:"sd_hash"`
BtInfohash []byte `protobuf:"bytes,7,opt,name=bt_infohash,json=btInfohash,proto3" json:"bt_infohash"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3482,9 +3482,9 @@ func (m *Source) GetBtInfohash() []byte {
}
type Fee struct {
Currency Fee_Currency `protobuf:"varint,1,opt,name=currency,proto3,enum=pb.Fee_Currency" json:"currency,omitempty"`
Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"`
Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"`
Currency Fee_Currency `protobuf:"varint,1,opt,name=currency,proto3,enum=pb.Fee_Currency" json:"currency"`
Address []byte `protobuf:"bytes,2,opt,name=address,proto3" json:"address"`
Amount uint64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3537,8 +3537,8 @@ func (m *Fee) GetAmount() uint64 {
}
type Image struct {
Width uint32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
Height uint32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Width uint32 `protobuf:"varint,1,opt,name=width,proto3" json:"width"`
Height uint32 `protobuf:"varint,2,opt,name=height,proto3" json:"height"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3584,10 +3584,10 @@ func (m *Image) GetHeight() uint32 {
}
type Video struct {
Width uint32 `protobuf:"varint,1,opt,name=width,proto3" json:"width,omitempty"`
Height uint32 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Duration uint32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration,omitempty"`
Audio *Audio `protobuf:"bytes,15,opt,name=audio,proto3" json:"audio,omitempty"`
Width uint32 `protobuf:"varint,1,opt,name=width,proto3" json:"width"`
Height uint32 `protobuf:"varint,2,opt,name=height,proto3" json:"height"`
Duration uint32 `protobuf:"varint,3,opt,name=duration,proto3" json:"duration"`
Audio *Audio `protobuf:"bytes,15,opt,name=audio,proto3" json:"audio"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3647,7 +3647,7 @@ func (m *Video) GetAudio() *Audio {
}
type Audio struct {
Duration uint32 `protobuf:"varint,1,opt,name=duration,proto3" json:"duration,omitempty"`
Duration uint32 `protobuf:"varint,1,opt,name=duration,proto3" json:"duration"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3686,7 +3686,7 @@ func (m *Audio) GetDuration() uint32 {
}
type Software struct {
Os string `protobuf:"bytes,1,opt,name=os,proto3" json:"os,omitempty"`
Os string `protobuf:"bytes,1,opt,name=os,proto3" json:"os"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3726,9 +3726,9 @@ func (m *Software) GetOs() string {
// RFC 5646
type Language struct {
Language Language_Language `protobuf:"varint,1,opt,name=language,proto3,enum=pb.Language_Language" json:"language,omitempty"`
Script Language_Script `protobuf:"varint,2,opt,name=script,proto3,enum=pb.Language_Script" json:"script,omitempty"`
Region Location_Country `protobuf:"varint,3,opt,name=region,proto3,enum=pb.Location_Country" json:"region,omitempty"`
Language Language_Language `protobuf:"varint,1,opt,name=language,proto3,enum=pb.Language_Language" json:"language"`
Script Language_Script `protobuf:"varint,2,opt,name=script,proto3,enum=pb.Language_Script" json:"script"`
Region Location_Country `protobuf:"varint,3,opt,name=region,proto3,enum=pb.Location_Country" json:"region"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -3781,12 +3781,12 @@ func (m *Language) GetRegion() Location_Country {
}
type Location struct {
Country Location_Country `protobuf:"varint,1,opt,name=country,proto3,enum=pb.Location_Country" json:"country,omitempty"`
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
City string `protobuf:"bytes,3,opt,name=city,proto3" json:"city,omitempty"`
Code string `protobuf:"bytes,4,opt,name=code,proto3" json:"code,omitempty"`
Latitude int32 `protobuf:"zigzag32,5,opt,name=latitude,proto3" json:"latitude,omitempty"`
Longitude int32 `protobuf:"zigzag32,6,opt,name=longitude,proto3" json:"longitude,omitempty"`
Country Location_Country `protobuf:"varint,1,opt,name=country,proto3,enum=pb.Location_Country" json:"country"`
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state"`
City string `protobuf:"bytes,3,opt,name=city,proto3" json:"city"`
Code string `protobuf:"bytes,4,opt,name=code,proto3" json:"code"`
Latitude int32 `protobuf:"zigzag32,5,opt,name=latitude,proto3" json:"latitude"`
Longitude int32 `protobuf:"zigzag32,6,opt,name=longitude,proto3" json:"longitude"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`

View file

@ -21,7 +21,7 @@ var _ = math.Inf
const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
type Purchase struct {
ClaimHash []byte `protobuf:"bytes,1,opt,name=claim_hash,json=claimHash,proto3" json:"claim_hash,omitempty"`
ClaimHash []byte `protobuf:"bytes,1,opt,name=claim_hash,json=claimHash,proto3" json:"claim_hash"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`

View file

@ -49,10 +49,10 @@ func (Error_Code) EnumDescriptor() ([]byte, []int) {
}
type Outputs struct {
Txos []*Output `protobuf:"bytes,1,rep,name=txos,proto3" json:"txos,omitempty"`
ExtraTxos []*Output `protobuf:"bytes,2,rep,name=extra_txos,json=extraTxos,proto3" json:"extra_txos,omitempty"`
Total uint32 `protobuf:"varint,3,opt,name=total,proto3" json:"total,omitempty"`
Offset uint32 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset,omitempty"`
Txos []*Output `protobuf:"bytes,1,rep,name=txos,proto3" json:"txos"`
ExtraTxos []*Output `protobuf:"bytes,2,rep,name=extra_txos,json=extraTxos,proto3" json:"extra_txos"`
Total uint32 `protobuf:"varint,3,opt,name=total,proto3" json:"total"`
Offset uint32 `protobuf:"varint,4,opt,name=offset,proto3" json:"offset"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -112,9 +112,9 @@ func (m *Outputs) GetOffset() uint32 {
}
type Output struct {
TxHash []byte `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"`
Nout uint32 `protobuf:"varint,2,opt,name=nout,proto3" json:"nout,omitempty"`
Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
TxHash []byte `protobuf:"bytes,1,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash"`
Nout uint32 `protobuf:"varint,2,opt,name=nout,proto3" json:"nout"`
Height uint32 `protobuf:"varint,3,opt,name=height,proto3" json:"height"`
// Types that are valid to be assigned to Meta:
// *Output_Claim
// *Output_Error
@ -216,23 +216,23 @@ func (*Output) XXX_OneofWrappers() []interface{} {
}
type ClaimMeta struct {
Channel *Output `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel,omitempty"`
Repost *Output `protobuf:"bytes,2,opt,name=repost,proto3" json:"repost,omitempty"`
ShortUrl string `protobuf:"bytes,3,opt,name=short_url,json=shortUrl,proto3" json:"short_url,omitempty"`
CanonicalUrl string `protobuf:"bytes,4,opt,name=canonical_url,json=canonicalUrl,proto3" json:"canonical_url,omitempty"`
IsControlling bool `protobuf:"varint,5,opt,name=is_controlling,json=isControlling,proto3" json:"is_controlling,omitempty"`
TakeOverHeight uint32 `protobuf:"varint,6,opt,name=take_over_height,json=takeOverHeight,proto3" json:"take_over_height,omitempty"`
CreationHeight uint32 `protobuf:"varint,7,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height,omitempty"`
ActivationHeight uint32 `protobuf:"varint,8,opt,name=activation_height,json=activationHeight,proto3" json:"activation_height,omitempty"`
ExpirationHeight uint32 `protobuf:"varint,9,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height,omitempty"`
ClaimsInChannel uint32 `protobuf:"varint,10,opt,name=claims_in_channel,json=claimsInChannel,proto3" json:"claims_in_channel,omitempty"`
Reposted uint32 `protobuf:"varint,11,opt,name=reposted,proto3" json:"reposted,omitempty"`
EffectiveAmount uint64 `protobuf:"varint,20,opt,name=effective_amount,json=effectiveAmount,proto3" json:"effective_amount,omitempty"`
SupportAmount uint64 `protobuf:"varint,21,opt,name=support_amount,json=supportAmount,proto3" json:"support_amount,omitempty"`
TrendingGroup uint32 `protobuf:"varint,22,opt,name=trending_group,json=trendingGroup,proto3" json:"trending_group,omitempty"`
TrendingMixed float32 `protobuf:"fixed32,23,opt,name=trending_mixed,json=trendingMixed,proto3" json:"trending_mixed,omitempty"`
TrendingLocal float32 `protobuf:"fixed32,24,opt,name=trending_local,json=trendingLocal,proto3" json:"trending_local,omitempty"`
TrendingGlobal float32 `protobuf:"fixed32,25,opt,name=trending_global,json=trendingGlobal,proto3" json:"trending_global,omitempty"`
Channel *Output `protobuf:"bytes,1,opt,name=channel,proto3" json:"channel"`
Repost *Output `protobuf:"bytes,2,opt,name=repost,proto3" json:"repost"`
ShortUrl string `protobuf:"bytes,3,opt,name=short_url,json=shortUrl,proto3" json:"short_url"`
CanonicalUrl string `protobuf:"bytes,4,opt,name=canonical_url,json=canonicalUrl,proto3" json:"canonical_url"`
IsControlling bool `protobuf:"varint,5,opt,name=is_controlling,json=isControlling,proto3" json:"is_controlling"`
TakeOverHeight uint32 `protobuf:"varint,6,opt,name=take_over_height,json=takeOverHeight,proto3" json:"take_over_height"`
CreationHeight uint32 `protobuf:"varint,7,opt,name=creation_height,json=creationHeight,proto3" json:"creation_height"`
ActivationHeight uint32 `protobuf:"varint,8,opt,name=activation_height,json=activationHeight,proto3" json:"activation_height"`
ExpirationHeight uint32 `protobuf:"varint,9,opt,name=expiration_height,json=expirationHeight,proto3" json:"expiration_height"`
ClaimsInChannel uint32 `protobuf:"varint,10,opt,name=claims_in_channel,json=claimsInChannel,proto3" json:"claims_in_channel"`
Reposted uint32 `protobuf:"varint,11,opt,name=reposted,proto3" json:"reposted"`
EffectiveAmount uint64 `protobuf:"varint,20,opt,name=effective_amount,json=effectiveAmount,proto3" json:"effective_amount"`
SupportAmount uint64 `protobuf:"varint,21,opt,name=support_amount,json=supportAmount,proto3" json:"support_amount"`
TrendingGroup uint32 `protobuf:"varint,22,opt,name=trending_group,json=trendingGroup,proto3" json:"trending_group"`
TrendingMixed float32 `protobuf:"fixed32,23,opt,name=trending_mixed,json=trendingMixed,proto3" json:"trending_mixed"`
TrendingLocal float32 `protobuf:"fixed32,24,opt,name=trending_local,json=trendingLocal,proto3" json:"trending_local"`
TrendingGlobal float32 `protobuf:"fixed32,25,opt,name=trending_global,json=trendingGlobal,proto3" json:"trending_global"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -383,8 +383,8 @@ func (m *ClaimMeta) GetTrendingGlobal() float32 {
}
type Error struct {
Code Error_Code `protobuf:"varint,1,opt,name=code,proto3,enum=pb.Error_Code" json:"code,omitempty"`
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
Code Error_Code `protobuf:"varint,1,opt,name=code,proto3,enum=pb.Error_Code" json:"code"`
Text string `protobuf:"bytes,2,opt,name=text,proto3" json:"text"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`