Make DefaultClient a method that returns the global default client

I made this a method to prevent other users from reassigning the
previously exported DefaultClient, e.g. doing something like:

```go
reddit.DefaultClient = nil
```

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian
2020-11-01 22:25:13 -05:00
parent 8fe2410f4a
commit 78dc97a8d5
6 changed files with 13 additions and 9 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ client, _ := reddit.NewClient(withCredentials, reddit.WithHTTPClient(httpClient)
### Read-Only Mode
The global `DefaultClient` variable is a valid, read-only client with limited access to the Reddit API, much like a logged out user. You can initialize your own via `NewReadonlyClient`:
The `DefaultClient` method returns a valid, read-only client with limited access to the Reddit API, much like a logged out user. You can initialize your own and configure it further using options via `NewReadonlyClient`:
```go
client, _ := reddit.NewReadonlyClient()