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)/...) LIST_PKG := $(shell go list $(ROOT_PKG)/...)
# Tests # 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 ## 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 ```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: Or for the latest version:
```sh ```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 ( import (
"context" "context"

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,4 +1,4 @@
package geddit package reddit
import ( import (
"net/url" "net/url"
@ -11,24 +11,24 @@ type Opt func(*Client) error
// FromEnv configures the client with values from environment variables. // FromEnv configures the client with values from environment variables.
// //
// Supported environment variables: // Supported environment variables:
// GEDDIT_CLIENT_ID to set the client's id. // GO_REDDIT_CLIENT_ID to set the client's id.
// GEDDIT_CLIENT_SECRET to set the client's secret. // GO_REDDIT_CLIENT_SECRET to set the client's secret.
// GEDDIT_CLIENT_USERNAME to set the client's username. // GO_REDDIT_CLIENT_USERNAME to set the client's username.
// GEDDIT_CLIENT_PASSWORD to set the client's password. // GO_REDDIT_CLIENT_PASSWORD to set the client's password.
func FromEnv(c *Client) error { 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 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 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 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 c.Password = v
} }

View file

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

View file

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

2
go.mod
View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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