Skip to content

Commit

Permalink
Fix `cannot use func literal (type func(*schema.ResourceDiff, interfa…
Browse files Browse the repository at this point in the history
…ce {}) error) as type schema.CustomizeDiffFunc in field value`
  • Loading branch information
pdecat committed Sep 28, 2021
1 parent 84e84f9 commit 9b6fc67
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pagerduty/resource_pagerduty_schedule.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pagerduty

import (
"context"
"fmt"
"log"
"regexp"
Expand All @@ -18,7 +19,7 @@ func resourcePagerDutySchedule() *schema.Resource {
Read: resourcePagerDutyScheduleRead,
Update: resourcePagerDutyScheduleUpdate,
Delete: resourcePagerDutyScheduleDelete,
CustomizeDiff: func(diff *schema.ResourceDiff, i interface{}) error {
CustomizeDiff: func(context context.Context, diff *schema.ResourceDiff, i interface{}) error {
ln := diff.Get("layer.#").(int)
for li := 0; li <= ln; li++ {
rn := diff.Get(fmt.Sprintf("layer.%d.restriction.#", li)).(int)
Expand Down
3 changes: 2 additions & 1 deletion pagerduty/resource_pagerduty_service.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pagerduty

import (
"context"
"fmt"
"log"
"regexp"
Expand All @@ -19,7 +20,7 @@ func resourcePagerDutyService() *schema.Resource {
Read: resourcePagerDutyServiceRead,
Update: resourcePagerDutyServiceUpdate,
Delete: resourcePagerDutyServiceDelete,
CustomizeDiff: func(diff *schema.ResourceDiff, i interface{}) error {
CustomizeDiff: func(context context.Context, diff *schema.ResourceDiff, i interface{}) error {
in := diff.Get("incident_urgency_rule.#").(int)
for i := 0; i <= in; i++ {
t := diff.Get(fmt.Sprintf("incident_urgency_rule.%d.type", i)).(string)
Expand Down
3 changes: 2 additions & 1 deletion pagerduty/resource_pagerduty_service_integration.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package pagerduty

import (
"context"
"fmt"
"log"
"strings"
Expand All @@ -17,7 +18,7 @@ func resourcePagerDutyServiceIntegration() *schema.Resource {
Read: resourcePagerDutyServiceIntegrationRead,
Update: resourcePagerDutyServiceIntegrationUpdate,
Delete: resourcePagerDutyServiceIntegrationDelete,
CustomizeDiff: func(diff *schema.ResourceDiff, i interface{}) error {
CustomizeDiff: func(context context.Context, diff *schema.ResourceDiff, i interface{}) error {
t := diff.Get("type").(string)
if t == "generic_email_inbound_integration" && diff.Get("integration_email").(string) == "" {
return fmt.Errorf("integration_email attribute must be set for an integration type generic_email_inbound_integration")
Expand Down

0 comments on commit 9b6fc67

Please sign in to comment.