From f23bd97b47d385d1e500692da5df8d4305142007 Mon Sep 17 00:00:00 2001 From: Harshil Goel Date: Thu, 14 Mar 2024 19:11:46 +0530 Subject: [PATCH] fixed test --- query/aggregator.go | 14 +++++++------- types/conversion.go | 2 +- types/conversion_test.go | 2 +- types/value_test.go | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/query/aggregator.go b/query/aggregator.go index af05ae792f7..a021555384d 100644 --- a/query/aggregator.go +++ b/query/aggregator.go @@ -590,16 +590,16 @@ var binaryFunctions = map[string]binaryFunc{ // In fact, if one of the arguments is a vector then the other *must* be // a scalar! var mixedScalarVectOps = map[string]struct{}{ - "*": struct{}{}, - "/": struct{}{}, + "*": {}, + "/": {}, } var opsAllowingVectorsOnRight = map[string]struct{}{ - "u-": struct{}{}, - "+": struct{}{}, - "-": struct{}{}, - "*": struct{}{}, - "dot": struct{}{}, + "u-": {}, + "+": {}, + "-": {}, + "*": {}, + "dot": {}, } type valType int diff --git a/types/conversion.go b/types/conversion.go index 098dbd06cfc..1e534bbdcaa 100644 --- a/types/conversion.go +++ b/types/conversion.go @@ -63,7 +63,7 @@ func ParseVFloat(s string) ([]float32, error) { if len(trimmed) == 0 { return []float32{}, nil } - if strings.Index(trimmed, ",") != -1 { + if strings.Contains(trimmed, ",") { // Splitting based on comma-separation. values := strings.Split(trimmed, ",") result := make([]float32, len(values)) diff --git a/types/conversion_test.go b/types/conversion_test.go index 1be23613905..10139d967c2 100644 --- a/types/conversion_test.go +++ b/types/conversion_test.go @@ -88,7 +88,7 @@ func TestConversionEdgeCases(t *testing.T) { }{ {in: Val{Tid: BinaryID}, out: Val{Tid: BinaryID}, - failure: "Invalid data to convert to binary"}, + failure: "invalid data to convert to binary"}, // From BinaryID to X {in: Val{Tid: BinaryID, Value: []byte{}}, diff --git a/types/value_test.go b/types/value_test.go index 389afbf6a83..04d7f514695 100644 --- a/types/value_test.go +++ b/types/value_test.go @@ -67,10 +67,10 @@ func TestTypeForValue(t *testing.T) { func TestFloatArrayTranslation(t *testing.T) { testCases := [][]float32{ - []float32{}, - []float32{0.1}, - []float32{0}, - []float32{0.65433, 1.855, 3.1415926539}, + {}, + {0.1}, + {0}, + {0.65433, 1.855, 3.1415926539}, } for _, tc := range testCases { asBytes := FloatArrayAsBytes(tc)