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

Update backend dependencies and linting issues #187

Merged
merged 5 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
27 changes: 11 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,29 @@ go 1.14

require (
bitbucket.org/creachadair/shell v0.0.6
github.com/apache/arrow/go/arrow v0.0.0-20210310141338-d1b01e64de23 // indirect
github.com/apache/arrow/go/arrow v0.0.0-20210417142526-fdd6ab11a71d // indirect
github.com/fatih/color v1.10.0 // indirect
github.com/google/flatbuffers v1.12.0 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/grafana/grafana-plugin-sdk-go v0.88.0
github.com/hashicorp/go-hclog v0.15.0 // indirect
github.com/grafana/grafana-plugin-sdk-go v0.92.0
github.com/hashicorp/go-hclog v0.16.0 // indirect
github.com/hashicorp/go-plugin v1.4.0 // indirect
github.com/hashicorp/yamux v0.0.0-20200609203250-aecfd211c9ce // indirect
github.com/hashicorp/yamux v0.0.0-20210316155119-a95892c5f864 // indirect
github.com/jhump/protoreflect v1.8.2 // indirect
github.com/klauspost/compress v1.12.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/magefile/mage v1.11.0
github.com/mattn/go-runewidth v0.0.10 // indirect
github.com/mattn/go-runewidth v0.0.12 // indirect
github.com/mediocregopher/radix/v3 v3.7.0
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/olekukonko/tablewriter v0.0.5 // indirect
github.com/prometheus/common v0.18.0 // indirect
github.com/prometheus/procfs v0.6.0 // indirect
github.com/pierrec/lz4/v4 v4.1.6 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/testify v1.7.0
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110 // indirect
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2 // indirect
golang.org/x/text v0.3.5 // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/genproto v0.0.0-20210309190941-1aeedc14537d // indirect
google.golang.org/grpc v1.36.0 // indirect
golang.org/x/net v0.0.0-20210415231046-e915ea6b2b7d // indirect
golang.org/x/sys v0.0.0-20210415045647-66c3f260301c // indirect
google.golang.org/genproto v0.0.0-20210416161957-9910b6c460de // indirect
google.golang.org/grpc v1.37.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
97 changes: 60 additions & 37 deletions go.sum

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pkg/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func query(ctx context.Context, query backend.DataQuery, client redisClient) bac
*/
default:
response := backend.DataResponse{}
log.DefaultLogger.Error("Query", "Command", qm.Command)
log.DefaultLogger.Debug("Query", "Command", qm.Command)
return response
}
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/redis-custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func executeCustomQuery(qm queryModel, client redisClient) (interface{}, error)

// Check if query is valid
if !ok {
err = fmt.Errorf("Query is not valid")
err = fmt.Errorf("query is not valid")
return result, err
}

Expand Down Expand Up @@ -81,7 +81,7 @@ func parseInterfaceValue(value []interface{}, response backend.DataResponse) ([]

values = append(values, parsedValues...)
default:
response.Error = fmt.Errorf("Unsupported array return type")
response.Error = fmt.Errorf("unsupported array return type")
return values, response
}
}
Expand All @@ -97,7 +97,7 @@ func queryCustomCommand(qm queryModel, client redisClient) backend.DataResponse

// Query is empty
if qm.Query == "" {
response.Error = fmt.Errorf("Command is empty")
response.Error = fmt.Errorf("command is empty")
return response
}

Expand Down Expand Up @@ -187,9 +187,9 @@ func queryCustomCommand(qm queryModel, client redisClient) backend.DataResponse
data.NewFrame(qm.Key,
data.NewField("Value", nil, values)))
case nil:
response.Error = fmt.Errorf("Wrong command")
response.Error = fmt.Errorf("wrong command")
default:
response.Error = fmt.Errorf("Unsupported return type")
response.Error = fmt.Errorf("unsupported return type")
}
}
// Return Response
Expand Down
10 changes: 5 additions & 5 deletions pkg/redis-custom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestExecuteCustomQuery(t *testing.T) {
"should handle error if invalid command string",
queryModel{Query: "lastsave \""},
nil,
errors.New("Query is not valid"),
errors.New("query is not valid"),
},
{
"should handle error",
Expand Down Expand Up @@ -114,7 +114,7 @@ func TestParseInterfaceValue(t *testing.T) {

expected := []string{"str", "str2", "42"}
result, response := parseInterfaceValue(input, inputResponse)
require.EqualError(t, response.Error, "Unsupported array return type", "Should return error")
require.EqualError(t, response.Error, "unsupported array return type", "Should return error")
require.Equal(t, expected, result, "Should contain results before unsupported parameter")
})

Expand Down Expand Up @@ -301,7 +301,7 @@ func TestQueryCustomCommand(t *testing.T) {
1,
nil,
nil,
"Wrong command",
"wrong command",
},
{
"should return error on int32 value (unsupported)",
Expand All @@ -311,7 +311,7 @@ func TestQueryCustomCommand(t *testing.T) {
1,
nil,
nil,
"Unsupported return type",
"unsupported return type",
},
{
"should fail with empty command",
Expand All @@ -321,7 +321,7 @@ func TestQueryCustomCommand(t *testing.T) {
0,
nil,
nil,
"Command is empty",
"command is empty",
},
{
"should handle error",
Expand Down
2 changes: 1 addition & 1 deletion pkg/redis-hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func queryHMGet(qm queryModel, client redisClient) backend.DataResponse {

// Check if filter is valid
if !ok {
response.Error = fmt.Errorf("Field is not valid")
response.Error = fmt.Errorf("field is not valid")
return response
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/redis-time-series.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func queryTsMRange(from int64, to int64, qm queryModel, client redisClient) back

// Check if filter is valid
if !ok {
response.Error = fmt.Errorf("Filter is not valid")
response.Error = fmt.Errorf("filter is not valid")
return response
}

Expand Down Expand Up @@ -316,7 +316,7 @@ func queryTsQueryIndex(qm queryModel, client redisClient) backend.DataResponse {

// Check if filter is valid
if !ok {
response.Error = fmt.Errorf("Filter is not valid")
response.Error = fmt.Errorf("filter is not valid")
return response
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/redis-time-series_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ func TestQueryTsMRange(t *testing.T) {
nil,
"",
"",
"Filter is not valid",
"filter is not valid",
nil,
},
{
Expand Down Expand Up @@ -582,7 +582,7 @@ func TestQueryTsQueryIndex(t *testing.T) {
0,
0,
nil,
errors.New("Filter is not valid"),
errors.New("filter is not valid"),
},
{
"should process receiver error",
Expand Down