Rename package to go-reddit

Signed-off-by: Vartan Benohanian <vartanbeno@gmail.com>
This commit is contained in:
Vartan Benohanian 2020-07-11 13:49:07 -04:00
parent f8d5a31b52
commit 4094044593
32 changed files with 53 additions and 53 deletions

View file

@ -1,4 +1,4 @@
ROOT_PKG ?= "github.com/vartanbeno/geddit"
ROOT_PKG ?= "github.com/vartanbeno/go-reddit"
LIST_PKG := $(shell go list $(ROOT_PKG)/...)
# Tests

View file

@ -1,17 +1,17 @@
# Geddit
# go-reddit
Geddit is a Go client library for accessing the Reddit API.
go-reddit is a Go client library for accessing the Reddit API.
## Install
To get a specific version from the list of [versions](https://github.com/vartanbeno/geddit/releases):
To get a specific version from the list of [versions](https://github.com/vartanbeno/go-reddit/releases):
```sh
go get github.com/vartanbeno/geddit@vX.Y.Z
go get github.com/vartanbeno/go-reddit@vX.Y.Z
```
Or for the latest version:
```sh
go get github.com/vartanbeno/geddit
go get github.com/vartanbeno/go-reddit
```

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"fmt"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"fmt"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"bytes"
@ -17,7 +17,7 @@ import (
)
const (
libraryName = "github.com/vartanbeno/geddit"
libraryName = "github.com/vartanbeno/go-reddit"
libraryVersion = "0.0.1"
defaultBaseURL = "https://oauth.reddit.com"

View file

@ -31,7 +31,7 @@ to https://www.reddit.com/api/v1/access_token with the following form values:
}
*/
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"net/url"
@ -11,24 +11,24 @@ type Opt func(*Client) error
// FromEnv configures the client with values from environment variables.
//
// Supported environment variables:
// GEDDIT_CLIENT_ID to set the client's id.
// GEDDIT_CLIENT_SECRET to set the client's secret.
// GEDDIT_CLIENT_USERNAME to set the client's username.
// GEDDIT_CLIENT_PASSWORD to set the client's password.
// GO_REDDIT_CLIENT_ID to set the client's id.
// GO_REDDIT_CLIENT_SECRET to set the client's secret.
// GO_REDDIT_CLIENT_USERNAME to set the client's username.
// GO_REDDIT_CLIENT_PASSWORD to set the client's password.
func FromEnv(c *Client) error {
if v, ok := os.LookupEnv("GEDDIT_CLIENT_ID"); ok {
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_ID"); ok {
c.ID = v
}
if v, ok := os.LookupEnv("GEDDIT_CLIENT_SECRET"); ok {
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_SECRET"); ok {
c.Secret = v
}
if v, ok := os.LookupEnv("GEDDIT_CLIENT_USERNAME"); ok {
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_USERNAME"); ok {
c.Username = v
}
if v, ok := os.LookupEnv("GEDDIT_CLIENT_PASSWORD"); ok {
if v, ok := os.LookupEnv("GO_REDDIT_CLIENT_PASSWORD"); ok {
c.Password = v
}

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"os"
@ -7,17 +7,17 @@ import (
)
func TestFromEnv(t *testing.T) {
os.Setenv("GEDDIT_CLIENT_ID", "id1")
defer os.Unsetenv("GEDDIT_CLIENT_ID")
os.Setenv("GO_REDDIT_CLIENT_ID", "id1")
defer os.Unsetenv("GO_REDDIT_CLIENT_ID")
os.Setenv("GEDDIT_CLIENT_SECRET", "secret1")
defer os.Unsetenv("GEDDIT_CLIENT_SECRET")
os.Setenv("GO_REDDIT_CLIENT_SECRET", "secret1")
defer os.Unsetenv("GO_REDDIT_CLIENT_SECRET")
os.Setenv("GEDDIT_CLIENT_USERNAME", "username1")
defer os.Unsetenv("GEDDIT_CLIENT_USERNAME")
os.Setenv("GO_REDDIT_CLIENT_USERNAME", "username1")
defer os.Unsetenv("GO_REDDIT_CLIENT_USERNAME")
os.Setenv("GEDDIT_CLIENT_PASSWORD", "password1")
defer os.Unsetenv("GEDDIT_CLIENT_PASSWORD")
os.Setenv("GO_REDDIT_CLIENT_PASSWORD", "password1")
defer os.Unsetenv("GO_REDDIT_CLIENT_PASSWORD")
c, err := NewClient(nil, FromEnv)
if err != nil {

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

2
go.mod
View file

@ -1,4 +1,4 @@
module github.com/vartanbeno/geddit
module github.com/vartanbeno/go-reddit
go 1.14

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"net/http"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"fmt"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"strconv"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"encoding/json"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"bytes"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"context"

View file

@ -1,4 +1,4 @@
package geddit
package reddit
import (
"fmt"