In the distant past this was necessary because:
1) the generated code depended on github.com/golang/protobuf,
but now it doesn't.
2) protoc-gen-go-grpc had a dependency on google.golang.org/grpc,
and the seperate go.mod file allowed us to isolate the dependency,
but that binary doesn't exist here anymore.
Drop the go.mod file for cmd/protoc-gen-go/testdata.
Change-Id: I7341d78dc346bd82e5c68ed48cee3275b6296249
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/220502
Reviewed-by: Damien Neil <dneil@google.com>
Move the Go cache from .cache/gocache to .gocache.
This moves it out of the .cache directory so that Travis-CI will
not cache the Go cache.
Unfortunately, the Go toolchain's caching algorithm is not
aggressive enough in evicting old entries, causing Travis-CI
to keep caching an ever growing Go cache.
We're at the point where network IO moving a massive Go cache
is more costly than not having it at all.
Change-Id: I3104efcdb8fa81a550900e8d06299e50296386f3
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/185838
Reviewed-by: Herbie Ong <herbie@google.com>
The go.sum is not particularly important for the testdata directory,
so ignore it.
Change-Id: I069613deda2af4944d09aed34008fec201df6bb4
Reviewed-on: https://go-review.googlesource.com/c/protobuf/+/166879
Reviewed-by: Herbie Ong <herbie@google.com>
This is a straight translation of the v1 API gRPC "plugin" to protogen.
Add a protoc-gen-go-grpc command. The preferred way to generate gRPC
services is to invoke both plugins separately:
protoc --go_out=. --go-grpc_out=. foo.proto
When invoked in this fashion, the generators will produce separate
foo.pb.go and foo_grpc.pb.go files.
Change-Id: Ie180385dab3da7063db96f7c2f9de3abbd749f63
Reviewed-on: https://go-review.googlesource.com/137037
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Use a local ".cache" directory in the repository root for the cache
instead of a directory in /tmp. On many operating systems, files are arbitrarily
purged as part of the OS' cleanup procedures, leading to obscure failures.
Since the build cache is in the repo root, we adjust the invocation of gofmt
to only act upon the set of Go files tracked by git.
Change-Id: I10cd0ea0de3370ea25fcd3870451fb41c4204a4b
Reviewed-on: https://go-review.googlesource.com/133875
Reviewed-by: Damien Neil <dneil@google.com>
Package protogen provides support for writing protoc plugins.
A "plugin" in this case is a program run by protoc to generate output.
The protoc-gen-go command is a protoc plugin to generate Go code.
cmd/protoc-gen-go/golden_test.go is mostly a straight copy from
the golden test in github.com/golang/protobuf.
Change-Id: I332d0df1e4b60bb8cd926320b8721e16b99a4b71
Reviewed-on: https://go-review.googlesource.com/130175
Reviewed-by: Joe Tsai <thebrokentoaster@gmail.com>
Use module support in Go1.11 to download the exact version of dependencies
as specified in the go.mod file, this is contrary to "go get -u", which grabs
the latest version, making reproducible builds and tests difficult.
In order for Go1.9 and Go1.10 to work, we also emit a vendor directory for
pre-module support.
Lastly, check whether the go.mod or go.sum files changed
(by shelling to "git diff"). This provides protection in case
a new dependency was added and the go.mod file was not updated.
Change-Id: Iac4e9b224ca9188dc9e63be720f188bfb5ee56ef
Reviewed-on: https://go-review.googlesource.com/127916
Reviewed-by: Bryan C. Mills <bcmills@google.com>