Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
mikefarah committed Jun 15, 2024
1 parent 42120e1 commit 3ea19ad
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions pkg/yqlib/operator_unique.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,15 @@ func uniqueBy(d *dataTreeNavigator, context Context, expressionNode *ExpressionN

func getUniqueKeyValue(rhs Context) (string, error) {
keyValue := "null"
var err error

if rhs.MatchingNodes.Len() > 0 {
first := rhs.MatchingNodes.Front()
keyCandidate := first.Value.(*CandidateNode)
keyValue = keyCandidate.Value
if keyCandidate.Kind != ScalarNode {
var err error
keyValue, err = encodeToString(keyCandidate, encoderPreferences{YamlFormat, 0})
if err != nil {
return "", err
}
}
}
return keyValue, nil
return keyValue, err
}

0 comments on commit 3ea19ad

Please sign in to comment.