Skip to content

Commit 9b6ee9c

Browse files
committed
chore: gofmt all code
1 parent 11c4d6f commit 9b6ee9c

34 files changed

+72
-55
lines changed

Makefile

+3-5
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ testdata/redis:
1919
testdata/redis/src/redis-server: testdata/redis
2020
cd $< && make all
2121

22-
tag:
23-
git tag $(VERSION)
24-
git tag extra/rediscmd/$(VERSION)
25-
git tag extra/redisotel/$(VERSION)
26-
git tag extra/rediscensus/$(VERSION)
22+
fmt:
23+
gofmt -w -s ./
24+
goimports -w -local github.com/go-redis/redis ./

cluster_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import (
99
"sync"
1010
"time"
1111

12-
"github.com/go-redis/redis/v8"
13-
"github.com/go-redis/redis/v8/internal/hashtag"
14-
1512
. "github.com/onsi/ginkgo"
1613
. "github.com/onsi/gomega"
14+
15+
"github.com/go-redis/redis/v8"
16+
"github.com/go-redis/redis/v8/internal/hashtag"
1717
)
1818

1919
type clusterScenario struct {

command_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"errors"
55
"time"
66

7-
redis "github.com/go-redis/redis/v8"
8-
97
. "github.com/onsi/ginkgo"
108
. "github.com/onsi/gomega"
9+
10+
redis "github.com/go-redis/redis/v8"
1111
)
1212

1313
var _ = Describe("Cmd", func() {
@@ -72,7 +72,7 @@ var _ = Describe("Cmd", func() {
7272
})
7373

7474
It("supports time.Time", func() {
75-
tm := time.Date(2019, 01, 01, 9, 45, 10, 222125, time.UTC)
75+
tm := time.Date(2019, 1, 1, 9, 45, 10, 222125, time.UTC)
7676

7777
err := client.Set(ctx, "time_key", tm, 0).Err()
7878
Expect(err).NotTo(HaveOccurred())

commands_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -472,11 +472,11 @@ var _ = Describe("Commands", func() {
472472
idleTime := client.ObjectIdleTime(ctx, "key")
473473
Expect(idleTime.Err()).NotTo(HaveOccurred())
474474

475-
//Redis returned milliseconds/1000, which may cause ObjectIdleTime to be at a critical value,
476-
//should be +1s to deal with the critical value problem.
477-
//if too much time (>1s) is used during command execution, it may also cause the test to fail.
478-
//so the ObjectIdleTime result should be <=now-start+1s
479-
//link: https://github.com/redis/redis/blob/5b48d900498c85bbf4772c1d466c214439888115/src/object.c#L1265-L1272
475+
// Redis returned milliseconds/1000, which may cause ObjectIdleTime to be at a critical value,
476+
// should be +1s to deal with the critical value problem.
477+
// if too much time (>1s) is used during command execution, it may also cause the test to fail.
478+
// so the ObjectIdleTime result should be <=now-start+1s
479+
// link: https://github.com/redis/redis/blob/5b48d900498c85bbf4772c1d466c214439888115/src/object.c#L1265-L1272
480480
Expect(idleTime.Val()).To(BeNumerically("<=", time.Now().Sub(start)+time.Second))
481481
})
482482

example/otel/main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ import (
44
"context"
55
"sync"
66

7-
"github.com/go-redis/redis/extra/redisotel/v8"
8-
"github.com/go-redis/redis/v8"
97
"go.opentelemetry.io/otel"
108
"go.opentelemetry.io/otel/codes"
119
"go.opentelemetry.io/otel/exporters/stdout/stdouttrace"
1210
sdktrace "go.opentelemetry.io/otel/sdk/trace"
11+
12+
"github.com/go-redis/redis/extra/redisotel/v8"
13+
"github.com/go-redis/redis/v8"
1314
)
1415

1516
var tracer = otel.Tracer("redisexample")

example/scan-struct/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55

66
"github.com/davecgh/go-spew/spew"
7+
78
"github.com/go-redis/redis/v8"
89
)
910

extra/rediscensus/rediscensus.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package rediscensus
33
import (
44
"context"
55

6+
"go.opencensus.io/trace"
7+
68
"github.com/go-redis/redis/extra/rediscmd/v8"
79
"github.com/go-redis/redis/v8"
8-
"go.opencensus.io/trace"
910
)
1011

1112
type TracingHook struct{}

extra/rediscmd/safe.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build appengine
12
// +build appengine
23

34
package rediscmd

extra/rediscmd/unsafe.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !appengine
12
// +build !appengine
23

34
package rediscmd

extra/redisotel/redisotel.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ package redisotel
33
import (
44
"context"
55

6-
"github.com/go-redis/redis/extra/rediscmd/v8"
7-
"github.com/go-redis/redis/v8"
86
"go.opentelemetry.io/otel"
97
"go.opentelemetry.io/otel/attribute"
108
"go.opentelemetry.io/otel/codes"
119
"go.opentelemetry.io/otel/trace"
10+
11+
"github.com/go-redis/redis/extra/rediscmd/v8"
12+
"github.com/go-redis/redis/v8"
1213
)
1314

1415
var tracer = otel.Tracer("github.com/go-redis/redis")

fuzz/fuzz.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
//go:build gofuzz
12
// +build gofuzz
23

34
package fuzz
45

56
import (
67
"context"
7-
"github.com/go-redis/redis/v8"
88
"time"
9+
10+
"github.com/go-redis/redis/v8"
911
)
1012

1113
var (

go.mod

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.13
44

55
require (
66
github.com/cespare/xxhash/v2 v2.1.2
7+
github.com/daixiang0/gci v0.2.9 // indirect
78
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f
89
github.com/google/go-cmp v0.5.6 // indirect
910
github.com/onsi/ginkgo v1.16.4

go.sum

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=
22
github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
3+
github.com/daixiang0/gci v0.2.9 h1:iwJvwQpBZmMg31w+QQ6jsyZ54KEATn6/nfARbBNW294=
4+
github.com/daixiang0/gci v0.2.9/go.mod h1:+4dZ7TISfSmqfAGv59ePaHfNzgGtIkHAhhdKggP1JAc=
35
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
46
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
57
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/rVNCu3HqELle0jiPLLBs70cWOduZpkS1E78=
@@ -73,6 +75,7 @@ golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
7375
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
7476
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
7577
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
78+
golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
7679
golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
7780
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
7881
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

internal/hashtag/hashtag_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package hashtag
33
import (
44
"testing"
55

6-
"github.com/go-redis/redis/v8/internal/rand"
7-
86
. "github.com/onsi/ginkgo"
97
. "github.com/onsi/gomega"
8+
9+
"github.com/go-redis/redis/v8/internal/rand"
1010
)
1111

1212
func TestGinkgoSuite(t *testing.T) {

internal/hscan/hscan_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var _ = Describe("Scan", func() {
6969
Expect(Scan(&d, i{v}, i{vals[k]})).To(HaveOccurred())
7070
}
7171

72-
//success
72+
// success
7373
f = func(v uint64) string {
7474
return strconv.FormatUint(v, 10)
7575
}

internal/pool/pool_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"testing"
88
"time"
99

10-
"github.com/go-redis/redis/v8/internal/pool"
11-
1210
. "github.com/onsi/ginkgo"
1311
. "github.com/onsi/gomega"
12+
13+
"github.com/go-redis/redis/v8/internal/pool"
1414
)
1515

1616
var _ = Describe("ConnPool", func() {

internal/proto/scan_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ package proto_test
33
import (
44
"encoding/json"
55

6-
"github.com/go-redis/redis/v8/internal/proto"
76
. "github.com/onsi/ginkgo"
87
. "github.com/onsi/gomega"
8+
9+
"github.com/go-redis/redis/v8/internal/proto"
910
)
1011

1112
type testScanSliceStruct struct {

internal/proto/writer_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ import (
66
"testing"
77
"time"
88

9-
"github.com/go-redis/redis/v8/internal/proto"
10-
119
. "github.com/onsi/ginkgo"
1210
. "github.com/onsi/gomega"
11+
12+
"github.com/go-redis/redis/v8/internal/proto"
1313
)
1414

1515
type MyType struct{}
@@ -51,7 +51,7 @@ var _ = Describe("WriteBuffer", func() {
5151
})
5252

5353
It("should append time", func() {
54-
tm := time.Date(2019, 01, 01, 9, 45, 10, 222125, time.UTC)
54+
tm := time.Date(2019, 1, 1, 9, 45, 10, 222125, time.UTC)
5555
err := wr.WriteArgs([]interface{}{tm})
5656
Expect(err).NotTo(HaveOccurred())
5757

internal/safe.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build appengine
12
// +build appengine
23

34
package internal

internal/unsafe.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !appengine
12
// +build !appengine
23

34
package internal

internal/util/safe.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build appengine
12
// +build appengine
23

34
package util

internal/util/unsafe.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build !appengine
12
// +build !appengine
23

34
package util

iterator_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package redis_test
33
import (
44
"fmt"
55

6-
"github.com/go-redis/redis/v8"
7-
86
. "github.com/onsi/ginkgo"
97
. "github.com/onsi/gomega"
8+
9+
"github.com/go-redis/redis/v8"
1010
)
1111

1212
var _ = Describe("ScanIterator", func() {

main_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212
"testing"
1313
"time"
1414

15-
"github.com/go-redis/redis/v8"
16-
1715
. "github.com/onsi/ginkgo"
1816
. "github.com/onsi/gomega"
17+
18+
"github.com/go-redis/redis/v8"
1919
)
2020

2121
const (
@@ -295,7 +295,7 @@ func redisDir(port string) (string, error) {
295295
if err := os.RemoveAll(dir); err != nil {
296296
return "", err
297297
}
298-
if err := os.MkdirAll(dir, 0775); err != nil {
298+
if err := os.MkdirAll(dir, 0o775); err != nil {
299299
return "", err
300300
}
301301
return dir, nil

options_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
//go:build go1.7
12
// +build go1.7
23

34
package redis

pipeline_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ package redis_test
33
import (
44
"strconv"
55

6-
"github.com/go-redis/redis/v8"
7-
86
. "github.com/onsi/ginkgo"
97
. "github.com/onsi/gomega"
8+
9+
"github.com/go-redis/redis/v8"
1010
)
1111

1212
var _ = Describe("pipelining", func() {

pool_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ import (
44
"context"
55
"time"
66

7-
"github.com/go-redis/redis/v8"
8-
97
. "github.com/onsi/ginkgo"
108
. "github.com/onsi/gomega"
9+
10+
"github.com/go-redis/redis/v8"
1111
)
1212

1313
var _ = Describe("pool", func() {

pubsub_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import (
77
"sync"
88
"time"
99

10-
"github.com/go-redis/redis/v8"
11-
1210
. "github.com/onsi/ginkgo"
1311
. "github.com/onsi/gomega"
12+
13+
"github.com/go-redis/redis/v8"
1414
)
1515

1616
var _ = Describe("PubSub", func() {

race_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"testing"
1111
"time"
1212

13-
"github.com/go-redis/redis/v8"
14-
1513
. "github.com/onsi/ginkgo"
1614
. "github.com/onsi/gomega"
15+
16+
"github.com/go-redis/redis/v8"
1717
)
1818

1919
var _ = Describe("races", func() {

redis_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ import (
88
"testing"
99
"time"
1010

11-
"github.com/go-redis/redis/v8"
12-
1311
. "github.com/onsi/ginkgo"
1412
. "github.com/onsi/gomega"
13+
14+
"github.com/go-redis/redis/v8"
1515
)
1616

1717
type redisHookError struct {

ring.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import (
1212
"time"
1313

1414
"github.com/cespare/xxhash/v2"
15-
"github.com/dgryski/go-rendezvous"
15+
rendezvous "github.com/dgryski/go-rendezvous" //nolint
16+
1617
"github.com/go-redis/redis/v8/internal"
1718
"github.com/go-redis/redis/v8/internal/hashtag"
1819
"github.com/go-redis/redis/v8/internal/pool"

ring_test.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import (
99
"sync"
1010
"time"
1111

12-
"github.com/go-redis/redis/v8"
13-
1412
. "github.com/onsi/ginkgo"
1513
. "github.com/onsi/gomega"
14+
15+
"github.com/go-redis/redis/v8"
1616
)
1717

1818
var _ = Describe("Redis Ring", func() {
@@ -190,8 +190,8 @@ var _ = Describe("Redis Ring", func() {
190190

191191
Describe("Process hook", func() {
192192
BeforeEach(func() {
193-
//the health check leads to data race for variable "stack []string".
194-
//here, the health check time is set to 72 hours to avoid health check
193+
// the health check leads to data race for variable "stack []string".
194+
// here, the health check time is set to 72 hours to avoid health check
195195
opt := redisRingOptions()
196196
opt.HeartbeatFrequency = 72 * time.Hour
197197
ring = redis.NewRing(opt)

0 commit comments

Comments
 (0)