chore: reformat code & removed unnecessary log statements
Signed-off-by: SoXX <soxx@fenpa.ws>
This commit is contained in:
parent
821462a426
commit
501dddc1c6
5
go.mod
5
go.mod
@ -3,7 +3,6 @@ module git.dragse.it/anthrove/e621-to-graph
|
|||||||
go 1.21.3
|
go 1.21.3
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/google/go-cmp v0.6.0 // indirect
|
github.com/jarcoal/httpmock v1.3.1
|
||||||
github.com/jarcoal/httpmock v1.3.1 // indirect
|
github.com/joho/godotenv v1.5.1
|
||||||
github.com/joho/godotenv v1.5.1 // indirect
|
|
||||||
)
|
)
|
||||||
|
6
go.sum
6
go.sum
@ -1,6 +1,8 @@
|
|||||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww=
|
github.com/jarcoal/httpmock v1.3.1 h1:iUx3whfZWVf3jT01hQTO/Eo5sAYtB2/rqaUuOtpInww=
|
||||||
github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg=
|
github.com/jarcoal/httpmock v1.3.1/go.mod h1:3yb8rc4BI7TCBhFY8ng0gjuLKJNquuDNiPaZjnENuYg=
|
||||||
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
github.com/joho/godotenv v1.5.1 h1:7eLL/+HRGLY0ldzfGMeQkb7vMd0as4CfYvUVzLqw0N0=
|
||||||
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
github.com/joho/godotenv v1.5.1/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
|
||||||
|
github.com/maxatome/go-testdeep v1.12.0 h1:Ql7Go8Tg0C1D/uMMX59LAoYK7LffeJQ6X2T04nTH68g=
|
||||||
|
github.com/maxatome/go-testdeep v1.12.0/go.mod h1:lPZc/HAcJMP92l7yI6TRz1aZN5URwUBUAfUNvrclaNM=
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -38,7 +37,7 @@ func (g getFavorites) SetLimit(limitFavorites int) FavoritesBuilder {
|
|||||||
func (g getFavorites) Execute() ([]model.Post, error) {
|
func (g getFavorites) Execute() ([]model.Post, error) {
|
||||||
favorites, err := endpoints.GetFavorites(g.requestContext, g.query)
|
favorites, err := endpoints.GetFavorites(g.requestContext, g.query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return favorites, nil
|
return favorites, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,7 +29,7 @@ func (g *getNote) SetNoteID(noteID int) NoteBuilder {
|
|||||||
func (g *getNote) Execute() (*model.Note, error) {
|
func (g *getNote) Execute() (*model.Note, error) {
|
||||||
note, err := endpoints.GetNote(g.requestContext, strconv.Itoa(g.noteID))
|
note, err := endpoints.GetNote(g.requestContext, strconv.Itoa(g.noteID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return ¬e, nil
|
return ¬e, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -68,7 +67,7 @@ func (g getNotes) SetLimit(limitNotes int) NotesBuilder {
|
|||||||
func (g getNotes) Execute() ([]model.Note, error) {
|
func (g getNotes) Execute() ([]model.Note, error) {
|
||||||
notes, err := endpoints.GetNotes(g.requestContext, g.query)
|
notes, err := endpoints.GetNotes(g.requestContext, g.query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return notes, nil
|
return notes, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ func (g getPool) ID(poolID int) PoolBuilder {
|
|||||||
func (g getPool) Execute() (model.Pool, error) {
|
func (g getPool) Execute() (model.Pool, error) {
|
||||||
pool, err := endpoints.GetPool(g.requestContext, strconv.Itoa(g.id))
|
pool, err := endpoints.GetPool(g.requestContext, strconv.Itoa(g.id))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return model.Pool{}, err
|
return model.Pool{}, err
|
||||||
}
|
}
|
||||||
return pool, nil
|
return pool, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -80,7 +79,7 @@ func (g *getPools) SetLimit(limitUser int) PoolsBuilder {
|
|||||||
func (g *getPools) Execute() ([]model.Pool, error) {
|
func (g *getPools) Execute() ([]model.Pool, error) {
|
||||||
pools, err := endpoints.GetPools(g.requestContext, g.query)
|
pools, err := endpoints.GetPools(g.requestContext, g.query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return pools, nil
|
return pools, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ func (g *getPost) SetPostID(postID int) PostBuilder {
|
|||||||
func (g *getPost) Execute() (*model.Post, error) {
|
func (g *getPost) Execute() (*model.Post, error) {
|
||||||
post, err := endpoints.GetPost(g.requestContext, strconv.Itoa(g.postID))
|
post, err := endpoints.GetPost(g.requestContext, strconv.Itoa(g.postID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &post, nil
|
return &post, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -50,7 +49,7 @@ func (g *getPosts) SetLimit(limitUser int) PostsBuilder {
|
|||||||
func (g *getPosts) Execute() ([]model.Post, error) {
|
func (g *getPosts) Execute() ([]model.Post, error) {
|
||||||
posts, err := endpoints.GetPosts(g.requestContext, g.query)
|
posts, err := endpoints.GetPosts(g.requestContext, g.query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return posts, err
|
return posts, err
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -29,7 +28,7 @@ func (g *getTag) SetTagID(tagID int) TagBuilder {
|
|||||||
func (g *getTag) Execute() (model.Tag, error) {
|
func (g *getTag) Execute() (model.Tag, error) {
|
||||||
tag, err := endpoints.GetTag(g.requestContext, strconv.Itoa(g.tagID))
|
tag, err := endpoints.GetTag(g.requestContext, strconv.Itoa(g.tagID))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return model.Tag{}, err
|
return model.Tag{}, err
|
||||||
}
|
}
|
||||||
return tag, nil
|
return tag, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -71,7 +70,7 @@ func (g *getTags) SetLimit(limitUser int) TagsBuilder {
|
|||||||
func (g *getTags) Execute() ([]model.Tag, error) {
|
func (g *getTags) Execute() ([]model.Tag, error) {
|
||||||
tags, err := endpoints.GetTags(g.requestContext, g.query)
|
tags, err := endpoints.GetTags(g.requestContext, g.query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return tags, err
|
return tags, err
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UserBuilder interface {
|
type UserBuilder interface {
|
||||||
@ -28,7 +27,7 @@ func (g *getUser) SetUsername(username string) UserBuilder {
|
|||||||
func (g *getUser) Execute() (*model.User, error) {
|
func (g *getUser) Execute() (*model.User, error) {
|
||||||
user, err := endpoints.GetUser(g.requestContext, g.username)
|
user, err := endpoints.GetUser(g.requestContext, g.username)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return &user, nil
|
return &user, nil
|
||||||
|
@ -3,7 +3,6 @@ package builder
|
|||||||
import (
|
import (
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/endpoints"
|
||||||
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
"git.dragse.it/anthrove/e621-to-graph/pkg/e621/model"
|
||||||
"log"
|
|
||||||
"strconv"
|
"strconv"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -35,7 +34,7 @@ func (g *getUsers) SetLimit(limitUser int) UsersBuilder {
|
|||||||
func (g *getUsers) Execute() ([]model.User, error) {
|
func (g *getUsers) Execute() ([]model.User, error) {
|
||||||
users, err := endpoints.GetUsers(g.requestContext, g.query)
|
users, err := endpoints.GetUsers(g.requestContext, g.query)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return users, nil
|
return users, nil
|
||||||
|
@ -57,7 +57,7 @@ func GetFavorites(requestContext model.RequestContext, query map[string]string)
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&favoriteResponse)
|
err = json.NewDecoder(resp.Body).Decode(&favoriteResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty User struct and the error.
|
// Log the error and return an empty User struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ func GetNote(requestContext model.RequestContext, ID string) (model.Note, error)
|
|||||||
r, err := http.NewRequest("GET", fmt.Sprintf("%s/notes/%s.json", requestContext.Host, ID), nil)
|
r, err := http.NewRequest("GET", fmt.Sprintf("%s/notes/%s.json", requestContext.Host, ID), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Note struct and the error.
|
// Log the error and return an empty Note struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Note{}, err
|
return model.Note{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ func GetNote(requestContext model.RequestContext, ID string) (model.Note, error)
|
|||||||
resp, err := requestContext.Client.Do(r)
|
resp, err := requestContext.Client.Do(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Note struct and the error.
|
// Log the error and return an empty Note struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Note{}, err
|
return model.Note{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ func GetNote(requestContext model.RequestContext, ID string) (model.Note, error)
|
|||||||
err = json.NewDecoder(resp.Body).Decode(¬eResponse)
|
err = json.NewDecoder(resp.Body).Decode(¬eResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Note struct and the error.
|
// Log the error and return an empty Note struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Note{}, err
|
return model.Note{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ func GetNotes(requestContext model.RequestContext, query map[string]string) ([]m
|
|||||||
err = json.Unmarshal(respBodyBytes, ¬esResponse)
|
err = json.Unmarshal(respBodyBytes, ¬esResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty slice and the error.
|
// Log the error and return an empty slice and the error.
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func GetPool(requestContext model.RequestContext, ID string) (model.Pool, error)
|
|||||||
r, err := http.NewRequest("GET", fmt.Sprintf("%s/pools/%s.json", requestContext.Host, ID), nil)
|
r, err := http.NewRequest("GET", fmt.Sprintf("%s/pools/%s.json", requestContext.Host, ID), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Pool struct and the error.
|
// Log the error and return an empty Pool struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Pool{}, err
|
return model.Pool{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ func GetPool(requestContext model.RequestContext, ID string) (model.Pool, error)
|
|||||||
resp, err := requestContext.Client.Do(r)
|
resp, err := requestContext.Client.Do(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Pool struct and the error.
|
// Log the error and return an empty Pool struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Pool{}, err
|
return model.Pool{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ func GetPool(requestContext model.RequestContext, ID string) (model.Pool, error)
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&poolResponse)
|
err = json.NewDecoder(resp.Body).Decode(&poolResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Pool struct and the error.
|
// Log the error and return an empty Pool struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Pool{}, err
|
return model.Pool{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ func GetPools(requestContext model.RequestContext, query map[string]string) ([]m
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&poolsResponse)
|
err = json.NewDecoder(resp.Body).Decode(&poolsResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty slice and the error.
|
// Log the error and return an empty slice and the error.
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ func GetPost(requestContext model.RequestContext, ID string) (model.Post, error)
|
|||||||
r, err := http.NewRequest("GET", fmt.Sprintf("%s/posts/%s.json", requestContext.Host, ID), nil)
|
r, err := http.NewRequest("GET", fmt.Sprintf("%s/posts/%s.json", requestContext.Host, ID), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Post struct and the error.
|
// Log the error and return an empty Post struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Post{}, err
|
return model.Post{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,7 +34,7 @@ func GetPost(requestContext model.RequestContext, ID string) (model.Post, error)
|
|||||||
resp, err := requestContext.Client.Do(r)
|
resp, err := requestContext.Client.Do(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Post struct and the error.
|
// Log the error and return an empty Post struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Post{}, err
|
return model.Post{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ func GetPost(requestContext model.RequestContext, ID string) (model.Post, error)
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&postResponse)
|
err = json.NewDecoder(resp.Body).Decode(&postResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Post struct and the error.
|
// Log the error and return an empty Post struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Post{}, err
|
return model.Post{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ func GetPosts(requestContext model.RequestContext, query map[string]string) ([]m
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&postResponse)
|
err = json.NewDecoder(resp.Body).Decode(&postResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty slice and the error.
|
// Log the error and return an empty slice and the error.
|
||||||
log.Println(err)
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func GetTag(requestContext model.RequestContext, ID string) (model.Tag, error) {
|
|||||||
r, err := http.NewRequest("GET", fmt.Sprintf("%s/tags/%s.json", requestContext.Host, ID), nil)
|
r, err := http.NewRequest("GET", fmt.Sprintf("%s/tags/%s.json", requestContext.Host, ID), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Tag struct and the error.
|
// Log the error and return an empty Tag struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Tag{}, err
|
return model.Tag{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ func GetTag(requestContext model.RequestContext, ID string) (model.Tag, error) {
|
|||||||
resp, err := requestContext.Client.Do(r)
|
resp, err := requestContext.Client.Do(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Tag struct and the error.
|
// Log the error and return an empty Tag struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Tag{}, err
|
return model.Tag{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ func GetTag(requestContext model.RequestContext, ID string) (model.Tag, error) {
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&tag)
|
err = json.NewDecoder(resp.Body).Decode(&tag)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty Tag struct and the error.
|
// Log the error and return an empty Tag struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.Tag{}, err
|
return model.Tag{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ func GetTags(requestContext model.RequestContext, query map[string]string) ([]mo
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&tags)
|
err = json.NewDecoder(resp.Body).Decode(&tags)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty slice and the error.
|
// Log the error and return an empty slice and the error.
|
||||||
log.Println(err)
|
|
||||||
return []model.Tag{}, err
|
return []model.Tag{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ func GetUser(requestContext model.RequestContext, username string) (model.User,
|
|||||||
r, err := http.NewRequest("GET", fmt.Sprintf("%s/users/%s.json", requestContext.Host, username), nil)
|
r, err := http.NewRequest("GET", fmt.Sprintf("%s/users/%s.json", requestContext.Host, username), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty User struct and the error.
|
// Log the error and return an empty User struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.User{}, err
|
return model.User{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ func GetUser(requestContext model.RequestContext, username string) (model.User,
|
|||||||
resp, err := requestContext.Client.Do(r)
|
resp, err := requestContext.Client.Do(r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty User struct and the error.
|
// Log the error and return an empty User struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.User{}, err
|
return model.User{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,7 +52,7 @@ func GetUser(requestContext model.RequestContext, username string) (model.User,
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&user)
|
err = json.NewDecoder(resp.Body).Decode(&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty User struct and the error.
|
// Log the error and return an empty User struct and the error.
|
||||||
log.Println(err)
|
|
||||||
return model.User{}, err
|
return model.User{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ func GetUsers(requestContext model.RequestContext, query map[string]string) ([]m
|
|||||||
err = json.NewDecoder(resp.Body).Decode(&users)
|
err = json.NewDecoder(resp.Body).Decode(&users)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// Log the error and return an empty slice and the error.
|
// Log the error and return an empty slice and the error.
|
||||||
log.Println(err)
|
|
||||||
return []model.User{}, err
|
return []model.User{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user