hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.28k stars 1.72k forks source link

Managing package with dep. #1727

Closed WalkerGriggs closed 6 years ago

WalkerGriggs commented 6 years ago

I've been working on an project which calls the provider directly (in this case it's google.Provider()). Previously, I was getting the package with with go get, but have since shifted to the dep tool for vendoring and version pinning.

The expected behavior is to vendor the dependency, but instead I'm running into number of build errors.

vendor/github.com/terraform-providers/terraform-provider-google/google/config.go:300:17: c.clientBilling.UserAgent undefined (type *cloudbilling.Service has no field or method UserAgent)
vendor/github.com/terraform-providers/terraform-provider-google/google/data_source_google_billing_account.go:54:36: config.clientBilling.BillingAccounts undefined (type *cloudbilling.Service has no field or method BillingAccounts)
vendor/github.com/terraform-providers/terraform-provider-google/google/data_source_google_billing_account.go:67:37: config.clientBilling.BillingAccounts undefined (type *cloudbilling.Service has no field or method BillingAccounts)
vendor/github.com/terraform-providers/terraform-provider-google/google/data_source_google_billing_account.go:95:35: config.clientBilling.BillingAccounts undefined (type *cloudbilling.Service has no field or method BillingAccounts)
vendor/github.com/terraform-providers/terraform-provider-google/google/resource_google_project.go:354:33: config.clientBilling.Projects undefined (type *cloudbilling.Service has no field or method Projects)
vendor/github.com/terraform-providers/terraform-provider-google/google/resource_google_project.go:596:32: config.clientBilling.Projects undefined (type *cloudbilling.Service has no field or method Projects)

Steps to reproduce:

  1. Populate a simple hello world which imports the provider.
    
    package main

import ("github.com/terraform-providers/terraform-provider-google/google")

func main() { _ = google.Provider() }

2. `dep init`

[[constraint]] name = "github.com/terraform-providers/terraform-provider-google" version = "1.15.0"



3. `go build`

_throws error_

4. Delete the vendor directory
5. `go get github.com/terraform-providers/terraform-provider-google/google`
6. `go build`

_builds successfully_

**Versions**
`go verison`
go version go1.10.3 linux/amd64

`dep version`
 version     : v0.4.1
 build date  : 2018-01-24
 git hash    : 37d9ea0a
 go version  : go1.9.1
 go compiler : gc
 platform    : linux/amd64
paddycarver commented 6 years ago

Hi @WalkerGriggs! Can you shed some light on exactly what action or assistance you would like from us on this issue? I'm having trouble figuring out if you're asking for us to switch from vendoring to using dep, if you're asking for us to make using the package with dep work, or if something else is going on here.

WalkerGriggs commented 6 years ago

Hi @paddycarver, my initial issue was a bit on the sparse side so let me clarify. I'm wondering if vendoring the package into 3rd party with dep is even supported. From your response, it seems that provider package doesn't/isn't intended to work with dep. In which case, this issue is as good as closed.

paddycarver commented 6 years ago

At the moment, I don't think any special effort is made to make the package vendorable. I suppose it's something that could be raised for discussion if there was enough interest in it, but I think even then, we'd probably revisit once the Go versioning experiment had a bit more mileage under it.

I'll close this out as you indicated, but I think our stance at the moment is that it may or may not work with dep, we don't know, and I don't know that we have an official position on whether it should or not. If you feel this should be reopened or would like to discuss the possibility of us deciding we want to support this, feel free to reply, and we can have that conversation.

ghost commented 5 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!