googlearchive / cloud-functions-go

Unofficial Native Go Runtime for Google Cloud Functions
Apache License 2.0
423 stars 44 forks source link

Why vendor folder is ignored (go project) #47

Open korjavin opened 5 years ago

korjavin commented 5 years ago

I am trying to deploy my go/http project as a function with a command like

gcloud functions deploy table-viewer --verbosity=debug --entry-point LambdaX --runtime go111 --trigger-http --set-env-vars AUTH_LOGIN=login,...

.gcloudignore contains both

go.sum
go.mod

From the output :

INFO: Using .gcloudignore file at [.../table-viewer/.gcloudignore].
DEBUG: Skipping file [go.mod]
DEBUG: Skipping file [go.sum]
DEBUG: Skipping file [.gitignore]
DEBUG: Skipping file [vendor]
DEBUG: Skipping file [vendor/golang.org]
DEBUG: Skipping file [vendor/golang.org/x]
DEBUG: Skipping file [vendor/golang.org/x/sys]
...

Why it ignores vendor folder?

sydneypemberton1986 commented 4 years ago

The issue is caused by the fact that .gcloudignore gets automatically generated with .gitignore in it which causes it to also ignore those files. However some of those files are necessary to the deployment in my case. This is strange implicit behavior. Adding something to .gitignore should not change the cloud tooling implicitly.

The fix is to either remove that line from the .gcloudignore or to turn off the feature entirely:

gcloud config set gcloudignore/enabled false