jbn
jbn

Reputation: 691

How do you deploy a golang google cloud function with a custom go build constraint/tag?

I am using go build constraints to conditionally compile constants into my test/staging/production cloud functions. How can I pass -tags ENV to the builder used by gcloud beta functions deploy?

Upvotes: 2

Views: 538

Answers (1)

gso_gabriel
gso_gabriel

Reputation: 4670

As @Guilherme mentioned in the comments, indeed, it seems that it's not possible to pass the go constraints/tags to the builder used by Cloud Functions.

I searched around and while there isn't this option, I think indeed, having the option to send constraints to the builder used by Cloud Functions. Considering that, I would recommend you to raise a Feature Request for this to be checked by Google.

One option that you might want to give a look at it, it's deploying your application using Cloud Run. As it's informed in their official documentation about this application:

Use the programming language of your choice, any language or operating system libraries, or even bring your own binaries.

Cloud Run pairs great with the container ecosystem: Cloud Build, Container Registry, Docker.

So, this might work for you as a workaround. In this below tutorial, there are the steps to build and deploy a quick application with Go in Cloud Run.

Let me know if the information helped you!

Upvotes: 1

Related Questions