Skip to content

Commit

Permalink
gofumpt
Browse files Browse the repository at this point in the history
  • Loading branch information
westy92 committed Aug 14, 2024
1 parent b9be1e0 commit 12edec0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ linters:
- err113
- funlen
- godox
- gofumpt
- nlreturn
- paralleltest
- testifylint
Expand Down
5 changes: 1 addition & 4 deletions example/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, "<your API key>")

Check warning on line 12 in example/main.go

View check run for this annotation

Codecov / codecov/patch

example/main.go#L12

Added line #L12 was not covered by tests

if err != nil {
fmt.Println(err)
return
Expand All @@ -25,7 +24,6 @@ func main() {
// Timezone: "America/Chicago",
// Adult: false,
})

if err != nil {
fmt.Println(err)
return
Expand All @@ -42,7 +40,6 @@ func main() {
// Start: 2020,
// End: 2030,
})

if err != nil {
fmt.Println(err)
return
Expand All @@ -52,12 +49,12 @@ func main() {

// Search for Events
query := "pizza day"

search, err := client.Search(ctx, holidays.SearchRequest{

Check warning on line 53 in example/main.go

View check run for this annotation

Codecov / codecov/patch

example/main.go#L53

Added line #L53 was not covered by tests
Query: query,
// These parameters are the defaults but can be specified:
// Adult: false,
})

if err != nil {
fmt.Println(err)
return
Expand Down
14 changes: 8 additions & 6 deletions holidays.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)},
}

Expand All @@ -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
Expand Down Expand Up @@ -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)},
}

Expand Down
3 changes: 1 addition & 2 deletions models.go
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 12edec0

Please sign in to comment.