Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Settle on concrete dependencies using Dep #2

Merged
merged 2 commits into from
Jun 7, 2018

Conversation

swgillespie
Copy link

This commit also accomodates two breaking changes in the Google Go SDK:
one, where a type was renamed, and two, when an API parameter was
generalized.

This repo originally used govendor, which is willing to vendor individual subpackages of one repo at different commit hashes. Conceptually, this is not a problem for Go and there's no reason why this is invalid, but the reality is that dep is very opinionated and does not allow this. Dep requires that all packages within a repo come from the same commit hash.

This poses a problem for us since the upstream repo vendors subpackages of cloud.google.com/go at different commit hashes. Since dep is absolutely not willing to budge on this issue, our options are 1) accept that we must use govendor and integrate govendor into the GCP provider build or 2) force this repo to adhere to dep, which means locking to a specific version of cloud.google.com/go and addressing the breakage that arises from that.

This PR takes option number 2 because there are only two places where locking cloud.google.com/go caused breakage:

  1. For whatever reason, the Google Go SDK renamed cloudbilling.Service to cloudbilling.APIService without bumping semver
  2. terraform-provider-google uses Beta Compute APIs to implement the google_compute_subnetwork_iam_policy, which made a breaking change.

I tried to run the upstream acceptance tests that test google_compute_subnetwork_iam_policy, but I couldn't get them to pass in the pristine upstream repo. The tests fail in the exact same way both with and without our fork's code.

This commit also accomodates two breaking changes in the Google Go SDK:
one, where a type was renamed, and two, when an API parameter was
generalized.
@joeduffy
Copy link
Member

joeduffy commented Jun 5, 2018

You, my friend, are a rock star 🎸. LGTM!

main.go Outdated
@@ -2,7 +2,7 @@ package main

import (
"github.com/hashicorp/terraform/plugin"
"github.com/terraform-providers/terraform-provider-google/google"
"github.com/pulumi/terraform-provider-google/google"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally we would leave this with the same package identity, and just bind to our fork via a dep repository mapping. Any reason you needed to change this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dep got extremely confused by this import and kept trying to make this repo vendor itself. I'm not sure why this happened but I can look into it in more detail if this is a little scary.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Figured this out, I did something dumb with GOPATH.

@swgillespie
Copy link
Author

Going to go ahead and merge this to get GCP rolling - I fixed the problem Luke pointed out and we should be good to go. Let me know if I should revert this.

@swgillespie swgillespie merged commit 2cc7a7f into pulumi-master Jun 7, 2018
@swgillespie swgillespie deleted the swgillespie/dep-wrangling branch June 7, 2018 01:20
@lukehoban
Copy link
Member

Great - thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants