Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lucifercr07 committed Dec 7, 2024
1 parent 612e7c3 commit 537236d
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 15 deletions.
15 changes: 8 additions & 7 deletions integration_tests/commands/http/command_getkeys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,14 @@ func TestCommandGetKeys(t *testing.T) {
},
expected: []interface{}{[]interface{}{"1 2 3 4 5 6 7"}},
},
{
name: "MSET command",
commands: []HTTPCommand{
{Command: "COMMAND/GETKEYS", Body: map[string]interface{}{"key": "MSET", "keys": []interface{}{"key1 key2"}, "values": []interface{}{" val1 val2"}}},
},
expected: []interface{}{"ERR invalid command specified"},
},
// Skipping these tests until multishards cmds supported by http
//{
// name: "MSET command",
// commands: []HTTPCommand{
// {Command: "COMMAND/GETKEYS", Body: map[string]interface{}{"key": "MSET", "keys": []interface{}{"key1 key2"}, "values": []interface{}{" val1 val2"}}},
// },
// expected: []interface{}{"ERR invalid command specified"},
//},
{
name: "Expire command",
commands: []HTTPCommand{
Expand Down
1 change: 1 addition & 0 deletions integration_tests/commands/http/set_data_cmd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ func TestSetDataCmd(t *testing.T) {
assert_type: []string{"equal", "array", "equal", "array"},
expected: []interface{}{float64(3), []any{string("bar"), string("baz"), string("bax")}, float64(0), []any{string("bar"), string("baz"), string("bax")}},
},
// Skipping these tests until multishards cmds supported by http
//{
// name: "SADD & SDIFF",
// commands: []HTTPCommand{
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/commands/http/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/dicedb/dice/internal/server/httpws"
"log"
"net/http"
"strings"
"sync"
"time"

"github.com/dicedb/dice/internal/server/httpws"

"github.com/dicedb/dice/config"
derrors "github.com/dicedb/dice/internal/errors"
"github.com/dicedb/dice/internal/querymanager"
Expand Down
1 change: 1 addition & 0 deletions integration_tests/commands/resp/command_getkeys_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var getKeysTestCases = []struct {
{"Get command", "get key", []interface{}{"key"}},
{"TTL command", "ttl key", []interface{}{"key"}},
{"Del command", "del 1 2 3 4 5 6", []interface{}{"1", "2", "3", "4", "5", "6"}},
// TODO: Fix this for multi shard support
//{"MSET command", "MSET key1 val1 key2 val2", []interface{}{"key1", "key2"}},
{"Expire command", "expire key time extra", []interface{}{"key"}},
{"Ping command", "ping", "ERR the command has no key arguments"},
Expand Down
3 changes: 2 additions & 1 deletion integration_tests/commands/websocket/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/dicedb/dice/internal/server/httpws"
"log"
"log/slog"
"net/http"
"sync"
"time"

"github.com/dicedb/dice/internal/server/httpws"

"github.com/dicedb/dice/config"
derrors "github.com/dicedb/dice/internal/errors"
"github.com/dicedb/dice/internal/querymanager"
Expand Down
3 changes: 2 additions & 1 deletion internal/eval/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package eval
import (
"errors"
"fmt"
"github.com/dicedb/dice/internal/object"
"strconv"
"strings"
"time"

"github.com/dicedb/dice/internal/object"

"github.com/dicedb/dice/internal/sql"

"github.com/dicedb/dice/config"
Expand Down
5 changes: 3 additions & 2 deletions internal/server/httpws/httpServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/dicedb/dice/internal/iothread"
"hash/crc32"
"log/slog"
"net/http"
"strings"
"sync"
"time"

"github.com/dicedb/dice/internal/iothread"

"github.com/dicedb/dice/internal/eval"
"github.com/dicedb/dice/internal/server/abstractserver"
"github.com/dicedb/dice/internal/wal"
Expand Down Expand Up @@ -386,7 +387,7 @@ func writeJSONResponse(writer http.ResponseWriter, response HTTPResponse, status
}
}

func writeErrorResponse(writer http.ResponseWriter, status int, message string, logMessage string, logFields ...any) {
func writeErrorResponse(writer http.ResponseWriter, status int, message, logMessage string, logFields ...any) {
responseJSON, _ := json.Marshal(HTTPResponse{Status: HTTPStatusError, Data: message})
writer.Header().Set("Content-Type", "application/json")
writer.WriteHeader(status)
Expand Down
3 changes: 2 additions & 1 deletion internal/server/httpws/redisCmdAdapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/dicedb/dice/internal/server/utils"
"io"
"net/http"
"regexp"
"strconv"
"strings"

"github.com/dicedb/dice/internal/server/utils"

"github.com/dicedb/dice/internal/cmd"
diceerrors "github.com/dicedb/dice/internal/errors"
)
Expand Down
3 changes: 2 additions & 1 deletion internal/server/httpws/websocketServer.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"encoding/json"
"errors"
"fmt"
"github.com/dicedb/dice/internal/iothread"
"log/slog"
"net"
"net/http"
Expand All @@ -15,6 +14,8 @@ import (
"syscall"
"time"

"github.com/dicedb/dice/internal/iothread"

"github.com/dicedb/dice/internal/server/abstractserver"
"github.com/dicedb/dice/internal/wal"

Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"github.com/dicedb/dice/internal/server/httpws"
"log/slog"
"net/http"
"os"
Expand All @@ -16,6 +15,8 @@ import (
"syscall"
"time"

"github.com/dicedb/dice/internal/server/httpws"

"github.com/dicedb/dice/internal/cli"
"github.com/dicedb/dice/internal/logger"
"github.com/dicedb/dice/internal/server/abstractserver"
Expand Down

0 comments on commit 537236d

Please sign in to comment.