Browse Source

Fix go vet warnings

Gary Burd 9 years ago
parent
commit
ac540e4138
2 changed files with 10 additions and 2 deletions
  1. 1 1
      redis/conn_test.go
  2. 9 1
      redis/script_test.go

+ 1 - 1
redis/conn_test.go

@@ -529,7 +529,7 @@ func TestDialURLDatabase(t *testing.T) {
 }
 }
 
 
 // Connect to local instance of Redis running on the default port.
 // Connect to local instance of Redis running on the default port.
-func ExampleDial(x int) {
+func ExampleDial() {
 	c, err := redis.Dial("tcp", ":6379")
 	c, err := redis.Dial("tcp", ":6379")
 	if err != nil {
 	if err != nil {
 		// handle error
 		// handle error

+ 9 - 1
redis/script_test.go

@@ -23,7 +23,15 @@ import (
 	"github.com/garyburd/redigo/redis"
 	"github.com/garyburd/redigo/redis"
 )
 )
 
 
-func ExampleScript(c redis.Conn, reply interface{}, err error) {
+var (
+	// These variables are declared at package level to remove distracting
+	// details from the examples.
+	c     redis.Conn
+	reply interface{}
+	err   error
+)
+
+func ExampleScript() {
 	// Initialize a package-level variable with a script.
 	// Initialize a package-level variable with a script.
 	var getScript = redis.NewScript(1, `return redis.call('get', KEYS[1])`)
 	var getScript = redis.NewScript(1, `return redis.call('get', KEYS[1])`)