...
1# Command examples for redis.io
2
3These examples appear on the [Redis documentation](https://redis.io) site as part of the tabbed examples interface.
4
5## How to add examples
6
7- Create a Go test file with a meaningful name in the current folder.
8- Create a single method prefixed with `Example` and write your test in it.
9- Determine the id for the example you're creating and add it as the first line of the file: `// EXAMPLE: set_and_get`.
10- We're using the [Testable Examples](https://go.dev/blog/examples) feature of Go to test the desired output has been written to stdout.
11
12### Special markup
13
14See https://github.com/redis-stack/redis-stack-website#readme for more details.
15
16## How to test the examples
17
18- Start a Redis server locally on port 6379
19- CD into the `doctests` directory
20- Run `go test` to test all examples in the directory.
21- Run `go test filename.go` to test a single file
22
View as plain text