grpc-ecosystem / grpc-cloud-run-example

118 stars 39 forks source link

Suggestion, feel free to close. #29

Open jvazquez opened 4 years ago

jvazquez commented 4 years ago

I'm extremely new to Golang, I don't know if this has room for these notes. Feel free to close the issue if it's not appropriate.

When containerizing the example code and you are using a private repository.

Since I'm not an expert in Golang I had a hard time understanding why running on host was trying to pull the code from bitbucket. In order to fix that, I cloned the repo inside $GOPATH/src/[bitbucket.org|github.com|gitlab.com] like https://golang.org/doc/gopath_code.html

If you are using a private repo to test out this code, you will need to do a couple of changes. Set the env for GOPRIVATE

ENV GOPRIVATE="domain.tld/your-name/your-project-name"

When adding the files inside the container, place them inside /go/src/ following the same path you used because the go.mod in this repo is pointing to a public repo, but you are using a private repo so you will try to fetch from the repo instead of pulling from the fs

I've also submitted a PR for a minor warning that popups when compiling the proto following this guide, that is #28

I'm using go 1.14 and this is my go env

{
        "AR": "ar",
        "CC": "gcc",
        "CGO_CFLAGS": "-g -O2",
        "CGO_CPPFLAGS": "",
        "CGO_CXXFLAGS": "-g -O2",
        "CGO_ENABLED": "1",
        "CGO_FFLAGS": "-g -O2",
        "CGO_LDFLAGS": "-g -O2",
        "CXX": "g++",
        "GCCGO": "gccgo",
        "GO111MODULE": "on",
        "GOARCH": "amd64",
        "GOBIN": "",
        "GOCACHE": "/home/jvazquez/.cache/go-build",
        "GOENV": "/home/jvazquez/.config/go/env",
        "GOEXE": "",
        "GOFLAGS": "",
        "GOGCCFLAGS": "-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build154605772=/tmp/go-build -gno-record-gcc-switches",
        "GOHOSTARCH": "amd64",
        "GOHOSTOS": "linux",
        "GOINSECURE": "",
        "GOMOD": "/home/jvazquez/go/src/bitbucket.org/jvazquezAR85/gcr-grpc/go.mod",
        "GONOPROXY": "bitbucket.org/jvazquezAR85/gcr-grpc,github.com/jvazquez/*",
        "GONOSUMDB": "bitbucket.org/jvazquezAR85/gcr-grpc,github.com/jvazquez/*",
        "GOOS": "linux",
        "GOPATH": "/home/jvazquez/go",
        "GOPRIVATE": "bitbucket.org/jvazquezAR85/gcr-grpc,github.com/jvazquez/*",
        "GOPROXY": "https://proxy.golang.org,direct",
        "GOROOT": "/usr/lib/go-1.14",
        "GOSUMDB": "sum.golang.org",
        "GOTMPDIR": "",
        "GOTOOLDIR": "/usr/lib/go-1.14/pkg/tool/linux_amd64",
        "PKG_CONFIG": "pkg-config"
}
gnossen commented 4 years ago

We weren't looking at things from the perspective of a private repo when writing these tutorials, but it certainly seems like something that a lot of people might be interested in. If you'd like to contribute your insight on what changes needed to be made to deploy from a private repo, we'd happily accept a pull request. 🙂