Skip to content

Commit 2713a25

Browse files
committed
readme: add go mod init
1 parent 9d85e76 commit 2713a25

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ Examples: https://godoc.org/github.com/go-redis/redis#pkg-examples.
2929

3030
go-redis requires a Go version with [Modules](https://github.com/golang/go/wiki/Modules) support and uses import versioning. So please make sure to initialize a Go module before installing go-redis:
3131

32-
```shell
33-
go get -u github.com/go-redis/redis/v7
32+
``` shell
33+
go mod init github.com/my/repo
34+
go get github.com/go-redis/redis/v7
3435
```
3536

3637
Import:
3738

38-
```go
39+
``` go
3940
import "github.com/go-redis/redis/v7"
4041
```
4142

4243
## Quickstart
4344

44-
```go
45+
``` go
4546
func ExampleNewClient() {
4647
client := redis.NewClient(&redis.Options{
4748
Addr: "localhost:6379",
@@ -87,7 +88,7 @@ Please go through [examples](https://godoc.org/github.com/go-redis/redis#pkg-exa
8788

8889
Some corner cases:
8990

90-
```go
91+
``` go
9192
// SET key value EX 10 NX
9293
set, err := client.SetNX("key", "value", 10*time.Second).Result()
9394

0 commit comments

Comments
 (0)