Skip to content

Commit

Permalink
Replaced nested ifs with conjunctions.
Browse files Browse the repository at this point in the history
Signed-off-by: Priyanshu Thapliyal <[email protected]>
  • Loading branch information
Priyanshuthapliyal2005 committed Dec 25, 2024
1 parent e5debd3 commit 8830b3c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions comid/measurement.go
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,8 @@ func (o Mval) MarshalJSON() ([]byte, error) {
return encoding.SerializeStructToJSON(o)
}

// Valid returns an error if none of the measurement values are set and the Extensions are empty.
func (o Mval) Valid() error {
// Check if all base types are nil and Extensions are not nil
if o.Ver == nil &&
o.SVN == nil &&
o.Digests == nil &&
Expand All @@ -437,8 +437,8 @@ func (o Mval) Valid() error {
o.UEID == nil &&
o.UUID == nil &&
o.IntegrityRegisters == nil &&
o.Extensions.IsEmpty() {
return fmt.Errorf("no measurement value set")
o.Extensions.IsEmpty() {
return fmt.Errorf("no measurement value set")
}

if o.Ver != nil {
Expand Down

0 comments on commit 8830b3c

Please sign in to comment.