From 41446df0796243e113a095bf037afc121ea18ef9 Mon Sep 17 00:00:00 2001 From: Jeremy Udit Date: Sun, 22 Nov 2020 15:27:50 -0500 Subject: [PATCH] rebase and fix build errors - update to go-github v32 - use `Owner` instead of `Organization` --- github/data_source_github_repository_milestone.go | 2 +- github/resource_github_repository_milestone.go | 15 ++++++++------- .../resource_github_repository_milestone_test.go | 8 ++++---- go.mod | 1 + go.sum | 3 +++ 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/github/data_source_github_repository_milestone.go b/github/data_source_github_repository_milestone.go index 6c517e332c..54c4628845 100644 --- a/github/data_source_github_repository_milestone.go +++ b/github/data_source_github_repository_milestone.go @@ -44,7 +44,7 @@ func dataSourceGithubRepositoryMilestone() *schema.Resource { } func dataSourceGithubRepositoryMilestoneRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*Organization).v3client + conn := meta.(*Owner).v3client ctx := context.Background() owner := d.Get("owner").(string) diff --git a/github/resource_github_repository_milestone.go b/github/resource_github_repository_milestone.go index 30be4bfa92..01b26f03cf 100644 --- a/github/resource_github_repository_milestone.go +++ b/github/resource_github_repository_milestone.go @@ -3,14 +3,15 @@ package github import ( "context" "fmt" - "github.com/google/go-github/v31/github" - "github.com/hashicorp/terraform-plugin-sdk/helper/schema" - "github.com/hashicorp/terraform-plugin-sdk/helper/validation" "log" "net/http" "strconv" "strings" "time" + + "github.com/google/go-github/v32/github" + "github.com/hashicorp/terraform-plugin-sdk/helper/schema" + "github.com/hashicorp/terraform-plugin-sdk/helper/validation" ) func resourceGithubRepositoryMilestone() *schema.Resource { @@ -81,7 +82,7 @@ const ( ) func resourceGithubRepositoryMilestoneCreate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*Organization).v3client + conn := meta.(*Owner).v3client ctx := context.Background() owner := d.Get("owner").(string) repoName := d.Get("repository").(string) @@ -117,7 +118,7 @@ func resourceGithubRepositoryMilestoneCreate(d *schema.ResourceData, meta interf } func resourceGithubRepositoryMilestoneRead(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*Organization).v3client + conn := meta.(*Owner).v3client ctx := context.WithValue(context.Background(), ctxId, d.Id()) owner := d.Get("owner").(string) @@ -156,7 +157,7 @@ func resourceGithubRepositoryMilestoneRead(d *schema.ResourceData, meta interfac } func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*Organization).v3client + conn := meta.(*Owner).v3client ctx := context.WithValue(context.Background(), ctxId, d.Id()) owner := d.Get("owner").(string) repoName := d.Get("repository").(string) @@ -201,7 +202,7 @@ func resourceGithubRepositoryMilestoneUpdate(d *schema.ResourceData, meta interf } func resourceGithubRepositoryMilestoneDelete(d *schema.ResourceData, meta interface{}) error { - conn := meta.(*Organization).v3client + conn := meta.(*Owner).v3client ctx := context.WithValue(context.Background(), ctxId, d.Id()) owner := d.Get("owner").(string) repoName := d.Get("repository").(string) diff --git a/github/resource_github_repository_milestone_test.go b/github/resource_github_repository_milestone_test.go index f6c7d74aa1..207dacd4f6 100644 --- a/github/resource_github_repository_milestone_test.go +++ b/github/resource_github_repository_milestone_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/google/go-github/v31/github" + "github.com/google/go-github/v32/github" "github.com/hashicorp/terraform-plugin-sdk/helper/acctest" "github.com/hashicorp/terraform-plugin-sdk/helper/resource" "github.com/hashicorp/terraform-plugin-sdk/terraform" @@ -185,7 +185,7 @@ func testAccCheckGithubRepositoryMilestoneExists(rn string, milestone *github.Mi return fmt.Errorf("no Milestone ID is set") } - conn := testAccProvider.Meta().(*Organization).v3client + conn := testAccProvider.Meta().(*Owner).v3client number, err := parseMilestoneNumber(rs.Primary.ID) if err != nil { return err @@ -209,7 +209,7 @@ func testAccCheckGithubRepositoryMilestoneDisappears(rn string) resource.TestChe if !ok { return fmt.Errorf("Not found: %s", rn) } - conn := testAccProvider.Meta().(*Organization).v3client + conn := testAccProvider.Meta().(*Owner).v3client number, err := parseMilestoneNumber(rs.Primary.ID) if err != nil { return err @@ -224,7 +224,7 @@ func testAccCheckGithubRepositoryMilestoneDisappears(rn string) resource.TestChe } func testAccCheckGithubRepositoryMilestoneDestroy(s *terraform.State) error { - conn := testAccProvider.Meta().(*Organization).v3client + conn := testAccProvider.Meta().(*Owner).v3client for _, rs := range s.RootModule().Resources { if rs.Type != "github_repository_milestone" { diff --git a/go.mod b/go.mod index 439d7644fa..7598170951 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,7 @@ go 1.13 require ( github.com/client9/misspell v0.3.4 github.com/golangci/golangci-lint v1.25.1 + github.com/google/go-github/v31 v31.0.0 github.com/google/go-github/v32 v32.1.0 github.com/hashicorp/terraform v0.12.24 github.com/hashicorp/terraform-plugin-sdk v1.7.0 diff --git a/go.sum b/go.sum index e860703a7b..0c7bf1d69d 100644 --- a/go.sum +++ b/go.sum @@ -204,6 +204,9 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY= +github.com/google/go-github/v31 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo= +github.com/google/go-github/v31 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM= github.com/google/go-github/v32 v31.0.0 h1:JJUxlP9lFK+ziXKimTCprajMApV1ecWD4NB6CCb0plo= github.com/google/go-github/v32 v31.0.0/go.mod h1:NQPZol8/1sMoWYGN2yaALIBytu17gAWfhbweiEed3pM= github.com/google/go-github/v32 v32.1.0 h1:GWkQOdXqviCPx7Q7Fj+KyPoGm4SwHRh8rheoPhd27II=