From 12edec04078058496cdb1e9a4691b29a597326d6 Mon Sep 17 00:00:00 2001 From: Seth Westphal Date: Wed, 14 Aug 2024 00:45:37 -0500 Subject: [PATCH] gofumpt --- .golangci.yml | 1 - example/main.go | 5 +---- holidays.go | 14 ++++++++------ models.go | 3 +-- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 4fa2189..255d32e 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,7 +8,6 @@ linters: - err113 - funlen - godox - - gofumpt - nlreturn - paralleltest - testifylint diff --git a/example/main.go b/example/main.go index a3ab17e..fee7e23 100644 --- a/example/main.go +++ b/example/main.go @@ -10,7 +10,6 @@ import ( func main() { // Get a FREE API key from https://apilayer.com/marketplace/checkiday-api#pricing client, err := holidays.New(holidays.APILayer, "") - if err != nil { fmt.Println(err) return @@ -25,7 +24,6 @@ func main() { // Timezone: "America/Chicago", // Adult: false, }) - if err != nil { fmt.Println(err) return @@ -42,7 +40,6 @@ func main() { // Start: 2020, // End: 2030, }) - if err != nil { fmt.Println(err) return @@ -52,12 +49,12 @@ func main() { // Search for Events query := "pizza day" + search, err := client.Search(ctx, holidays.SearchRequest{ Query: query, // These parameters are the defaults but can be specified: // Adult: false, }) - if err != nil { fmt.Println(err) return diff --git a/holidays.go b/holidays.go index 8cea199..d7c011d 100644 --- a/holidays.go +++ b/holidays.go @@ -12,9 +12,11 @@ import ( "strconv" ) -var ErrAPIProviderRequired = errors.New("please provide a valid API provider") -var ErrEventIDRequired = errors.New("event id is required") -var ErrSearchQueryRequired = errors.New("search query is required") +var ( + ErrAPIProviderRequired = errors.New("please provide a valid API provider") + ErrEventIDRequired = errors.New("event id is required") + ErrSearchQueryRequired = errors.New("search query is required") +) // The API Client. type Client struct { @@ -47,7 +49,7 @@ func New(apiProvider APIProvider, apiKey string) (*Client, error) { // Gets the Events for the provided Date. func (c *Client) GetEvents(ctx context.Context, req GetEventsRequest) (*GetEventsResponse, error) { - var params = url.Values{ + params := url.Values{ "adult": {strconv.FormatBool(req.Adult)}, } @@ -71,7 +73,7 @@ func (c *Client) GetEvents(ctx context.Context, req GetEventsRequest) (*GetEvent // Gets the Event Info for the provided Event. func (c *Client) GetEventInfo(ctx context.Context, req GetEventInfoRequest) (*GetEventInfoResponse, error) { - var params = url.Values{} + params := url.Values{} if req.ID == "" { return nil, ErrEventIDRequired @@ -99,7 +101,7 @@ func (c *Client) GetEventInfo(ctx context.Context, req GetEventInfoRequest) (*Ge // Searches for Events with the given criteria. func (c *Client) Search(ctx context.Context, req SearchRequest) (*SearchResponse, error) { - var params = url.Values{ + params := url.Values{ "adult": {strconv.FormatBool(req.Adult)}, } diff --git a/models.go b/models.go index cd88c0c..2f3623b 100644 --- a/models.go +++ b/models.go @@ -1,8 +1,7 @@ package holidays // An interface of the API's standard response. -type StandardResponseInterface interface { -} +type StandardResponseInterface interface{} // The API's standard response. type StandardResponse struct {