Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use value receivers for MarshalXXX methods #117

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions comid/classid.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ func (o TaggedImplID) Bytes() []byte {
return o[:]
}

func (o *TaggedImplID) MarshalJSON() ([]byte, error) {
return json.Marshal((*o)[:])
func (o TaggedImplID) MarshalJSON() ([]byte, error) {
return json.Marshal((o)[:])
}

func (o *TaggedImplID) UnmarshalJSON(data []byte) error {
Expand Down
4 changes: 2 additions & 2 deletions comid/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ func (o *Entity) UnmarshalCBOR(data []byte) error {
}

// MarshalCBOR serializes to CBOR
func (o *Entity) MarshalCBOR() ([]byte, error) {
func (o Entity) MarshalCBOR() ([]byte, error) {
return encoding.SerializeStructToCBOR(em, o)
}

Expand All @@ -100,7 +100,7 @@ func (o *Entity) UnmarshalJSON(data []byte) error {
}

// MarshalJSON serializes to JSON
func (o *Entity) MarshalJSON() ([]byte, error) {
func (o Entity) MarshalJSON() ([]byte, error) {
return encoding.SerializeStructToJSON(o)
}

Expand Down
4 changes: 2 additions & 2 deletions comid/flagsmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
}

// MarshalCBOR serializes to CBOR
func (o *FlagsMap) MarshalCBOR() ([]byte, error) {
func (o FlagsMap) MarshalCBOR() ([]byte, error) {

Check failure on line 200 in comid/flagsmap.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (88 bytes); consider passing it by pointer (gocritic)

Check failure on line 200 in comid/flagsmap.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (88 bytes); consider passing it by pointer (gocritic)
return encoding.SerializeStructToCBOR(em, o)
}

Expand All @@ -207,11 +207,11 @@
}

// MarshalJSON serializes to JSON
func (o *FlagsMap) MarshalJSON() ([]byte, error) {
func (o FlagsMap) MarshalJSON() ([]byte, error) {

Check failure on line 210 in comid/flagsmap.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (88 bytes); consider passing it by pointer (gocritic)

Check failure on line 210 in comid/flagsmap.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (88 bytes); consider passing it by pointer (gocritic)
return encoding.SerializeStructToJSON(o)
}

// Valid returns an error if the FlagsMap is invalid.
func (o FlagsMap) Valid() error {

Check failure on line 215 in comid/flagsmap.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (88 bytes); consider passing it by pointer (gocritic)

Check failure on line 215 in comid/flagsmap.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (88 bytes); consider passing it by pointer (gocritic)
return o.Extensions.validFlagsMap(&o)
}
4 changes: 2 additions & 2 deletions comid/measurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@
}

// MarshalCBOR serializes to CBOR
func (o *Mval) MarshalCBOR() ([]byte, error) {
func (o Mval) MarshalCBOR() ([]byte, error) {

Check failure on line 377 in comid/measurement.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (112 bytes); consider passing it by pointer (gocritic)

Check failure on line 377 in comid/measurement.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (112 bytes); consider passing it by pointer (gocritic)
return encoding.SerializeStructToCBOR(em, o)
}

Expand All @@ -384,11 +384,11 @@
}

// MarshalJSON serializes to JSON
func (o *Mval) MarshalJSON() ([]byte, error) {
func (o Mval) MarshalJSON() ([]byte, error) {

Check failure on line 387 in comid/measurement.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (112 bytes); consider passing it by pointer (gocritic)

Check failure on line 387 in comid/measurement.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (112 bytes); consider passing it by pointer (gocritic)
return encoding.SerializeStructToJSON(o)
}

func (o Mval) Valid() error {

Check failure on line 391 in comid/measurement.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (112 bytes); consider passing it by pointer (gocritic)

Check failure on line 391 in comid/measurement.go

View workflow job for this annotation

GitHub Actions / Lint

hugeParam: o is heavy (112 bytes); consider passing it by pointer (gocritic)
if o.Ver == nil &&
o.SVN == nil &&
o.Digests == nil &&
Expand Down
4 changes: 2 additions & 2 deletions comid/triples.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (o *Triples) UnmarshalCBOR(data []byte) error {
}

// MarshalCBOR serializes to CBOR
func (o *Triples) MarshalCBOR() ([]byte, error) {
func (o Triples) MarshalCBOR() ([]byte, error) {
return encoding.SerializeStructToCBOR(em, o)
}

Expand All @@ -45,7 +45,7 @@ func (o *Triples) UnmarshalJSON(data []byte) error {
}

// MarshalJSON serializes to JSON
func (o *Triples) MarshalJSON() ([]byte, error) {
func (o Triples) MarshalJSON() ([]byte, error) {
return encoding.SerializeStructToJSON(o)
}

Expand Down
4 changes: 2 additions & 2 deletions corim/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (o *Entity) UnmarshalCBOR(data []byte) error {
}

// MarshalCBOR serializes to CBOR
func (o *Entity) MarshalCBOR() ([]byte, error) {
func (o Entity) MarshalCBOR() ([]byte, error) {
return encoding.SerializeStructToCBOR(em, o)
}

Expand All @@ -113,7 +113,7 @@ func (o *Entity) UnmarshalJSON(data []byte) error {
}

// MarshalJSON serializes to JSON
func (o *Entity) MarshalJSON() ([]byte, error) {
func (o Entity) MarshalJSON() ([]byte, error) {
return encoding.SerializeStructToJSON(o)
}

Expand Down
4 changes: 2 additions & 2 deletions corim/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ func (o *Signer) UnmarshalCBOR(data []byte) error {
}

// MarshalCBOR serializes to CBOR
func (o *Signer) MarshalCBOR() ([]byte, error) {
func (o Signer) MarshalCBOR() ([]byte, error) {
return encoding.SerializeStructToCBOR(em, o)
}

Expand All @@ -94,7 +94,7 @@ func (o *Signer) UnmarshalJSON(data []byte) error {
}

// MarshalJSON serializes to JSON
func (o *Signer) MarshalJSON() ([]byte, error) {
func (o Signer) MarshalJSON() ([]byte, error) {
return encoding.SerializeStructToJSON(o)
}

Expand Down
Loading