Merge pull request #481 from go-redis/fix/go18-tests

Fix error message for Go 1.8.
This commit is contained in:
Vladimir Mihailenco 2017-01-26 16:42:46 +02:00 committed by GitHub
commit 9cd4965689
2 changed files with 3 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package redis
import ( import (
"crypto/tls" "crypto/tls"
"errors" "errors"
"fmt"
"net" "net"
"net/url" "net/url"
"strconv" "strconv"
@ -151,7 +152,7 @@ func ParseURL(redisURL string) (*Options, error) {
o.DB = 0 o.DB = 0
case 1: case 1:
if o.DB, err = strconv.Atoi(f[0]); err != nil { if o.DB, err = strconv.Atoi(f[0]); err != nil {
return nil, errors.New("invalid redis database number: " + err.Error()) return nil, fmt.Errorf("invalid redis database number: %q", f[0])
} }
default: default:
return nil, errors.New("invalid redis URL path: " + u.Path) return nil, errors.New("invalid redis URL path: " + u.Path)

View File

@ -63,7 +63,7 @@ func TestParseURL(t *testing.T) {
{ {
"redis://localhost/iamadatabase", "redis://localhost/iamadatabase",
"", "",
0, false, errors.New("invalid redis database number: strconv.ParseInt: parsing \"iamadatabase\": invalid syntax"), 0, false, errors.New(`invalid redis database number: "iamadatabase"`),
}, },
} }