diff --git a/cmd/kvrepl/main.go b/cmd/kvrepl/main.go index 7cbbc48..f416a2f 100644 --- a/cmd/kvrepl/main.go +++ b/cmd/kvrepl/main.go @@ -9,9 +9,11 @@ import ( ) func main() { - d := &kvrepl.DB{PKV: true} - d.KV1 = make(map[string]string) - d.KV2 = make(map[string]string) + d := &kvrepl.DB{ + KV1: map[string]string{}, + KV2: map[string]string{}, + PKV: true, + } scanner := bufio.NewScanner(os.Stdin) for scanner.Scan() { v, err := kvrepl.Parse(scanner.Text(), d) diff --git a/db_test.go b/db_test.go index 2e85de4..07c07d1 100644 --- a/db_test.go +++ b/db_test.go @@ -81,7 +81,7 @@ func TestSeries(t *testing.T) { "failed series:\n\tfailed to write", ) } - v, err := read([]string{"a"}, kv) + v, _ := read([]string{"a"}, kv) if v != "b" { t.Errorf( "failed series:\n\texpected: %v\n\t actual: %v", @@ -89,8 +89,8 @@ func TestSeries(t *testing.T) { v, ) } - err = del([]string{"a"}, kv) - v, err = read([]string{"a"}, kv) + _ = del([]string{"a"}, kv) + v, _ = read([]string{"a"}, kv) if v != "" { t.Errorf( "failed series:\n\texpected: %v\n\t actual: %v", diff --git a/parse.go b/parse.go index db957cf..87c2e17 100644 --- a/parse.go +++ b/parse.go @@ -7,7 +7,7 @@ import ( ) // Parse decides what commands to run and returns a string containing the -// value of a read or an error if one occured. +// value of a read or an error if one occurred. func Parse(s string, d *DB) (string, error) { args := strings.Split(s, " ")