@ -48,6 +48,15 @@ func main() {
if options.password != "" {
fmt.Fprintf(conn, "*2\r\n$4\r\nauth\r\n$%d\r\n%s\r\n", len(options.password), options.password)
v, err := readValue(conn)
if err != nil {
fmt.Printf("unable to auth: %v\n", err)
os.Exit(1)
}
if !isOK(v) {
fmt.Printf("not OK: %v\n", v)
infile, err := os.Open(fname)
@ -19,6 +19,14 @@ type value interface {
Write(io.Writer) (int, error)
func isOK(v value) bool {
vv, ok := v.(String)
if !ok {
return false
return vv == "OK"
func streamValues(r io.Reader, c chan value, e chan error) {
defer close(c)
defer close(e)