Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf APIV2 #304

Merged
merged 10 commits into from
May 3, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ Generally you want to make changes and run `make`, which will install all
dependencies we know about, build the core, and run all of the tests that we
have against Go and Python code. A few notes:

* Make sure to clone the repo on `$GOPATH/src/github.com/twitchtv/twirp`
* Run Go unit tests with `make test_core`, or just the tests with `go test -race ./...` (make sure to re-generate code with `make generate` before running unit tests).
* Clone the repo on `$GOPATH/src/github.com/twitchtv/twirp` (go modules not supported yet).
* Run Go unit tests with `make test`.
* Most tests of the Go server are in `internal/twirptest/service_test.go`.
* Integration tests running the full stack in both Go and Python auto-generated clients are in the [clientcompat](./clientcompat) directory.

Expand Down
84 changes: 62 additions & 22 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@
# tests and building main packages.

[[override]]
name = "github.com/gogo/protobuf"
version = "0.5.0"

[[override]]
branch = "master"
name = "github.com/golang/protobuf"
name = "google.golang.org/protobuf"
version = "1.26.0"

[[override]]
name = "github.com/pkg/errors"
Expand Down
51 changes: 22 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,45 +1,38 @@
RETOOL=$(CURDIR)/_tools/bin/retool
PATH := ${PWD}/bin:${PWD}/ENV/bin:${PATH}
DOCKER_RELEASE_IMAGE := golang:1.12.0-stretch
.DEFAULT_GOAL := all
PATH := ${PWD}/_tools/bin:${PWD}/bin:${PWD}/ENV/bin:${PATH}
export GO111MODULE=off

all: setup test_all

.PHONY: test test_all test_core test_clients test_go_client test_python_client generate release_gen
.PHONY: setup generate test_all test test_clients test_go_client test_python_client

# Phony commands:
generate:
PATH=$(CURDIR)/_tools/bin:$(PATH) GOBIN="${PWD}/bin" go install -v ./protoc-gen-...
$(RETOOL) do go generate ./...
setup:
./check_protoc_version.sh
GOPATH=$(CURDIR)/_tools GOBIN=$(CURDIR)/_tools/bin go get github.com/twitchtv/retool
./_tools/bin/retool build

gen:
# Recompile and install generator
GOBIN="$$PWD/bin" go install -v ./protoc-gen-twirp
GOBIN="$$PWD/bin" go install -v ./protoc-gen-twirp_python
# Generate code from go:generate comments
go generate ./...

test_all: setup test_core test_clients
test_all: setup test test_clients

test_core: generate
$(RETOOL) do errcheck -blank ./internal/twirptest
go test -race $(shell go list ./... | grep -v /vendor/ | grep -v /_tools/)
test: gen
./_tools/bin/errcheck ./internal/twirptest
go test -race $(shell GO111MODULE=off go list ./... | grep -v /vendor/ | grep -v /_tools/)

test_clients: test_go_client test_python_client

test_go_client: generate build/clientcompat build/gocompat
test_go_client: gen build/clientcompat build/gocompat
./build/clientcompat -client ./build/gocompat

test_python_client: generate build/clientcompat build/pycompat
test_python_client: gen build/clientcompat build/pycompat
./build/clientcompat -client ./build/pycompat

setup:
./install_proto.bash
GO111MODULE=off GOPATH=$(CURDIR)/_tools GOBIN=$(CURDIR)/_tools/bin go get github.com/twitchtv/retool
$(RETOOL) build

release_gen:
git clean -xdf
docker run \
--volume "$(CURDIR):/go/src/github.com/twitchtv/twirp" \
--workdir "/go/src/github.com/twitchtv/twirp" \
$(DOCKER_RELEASE_IMAGE) \
internal/release_gen.sh

# Actual files for testing clients:

# For clientcompat and testing Python
./build:
mkdir build

Expand Down
15 changes: 1 addition & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,9 @@ For more on the motivation behind Twirp (and a comparison to REST APIs and gRPC)
[announcement blog post](https://blog.twitch.tv/en/2018/01/16/twirp-a-sweet-new-rpc-framework-for-go-5f2febbf35f/)
is a good read.

### Installation
Use `go get` to install the Go client-and-server generator:

```
go get github.com/twitchtv/twirp/protoc-gen-twirp
```

You will also need:
- [protoc](https://github.com/protocolbuffers/protobuf), the protobuf compiler. You need
version 3+.
- [github.com/golang/protobuf/protoc-gen-go](https://github.com/golang/protobuf/),
the Go protobuf generator plugin. Get this with `go get`.

### Documentation

On the website: https://twitchtv.github.io/twirp/docs/intro.html
Documentation: https://twitchtv.github.io/twirp/docs/intro.html

Source for this documentation is in the [docs](./docs) subdirectory. The website
is generated from that folder using [Docusaurus](https://docusaurus.io/).
Expand Down
2 changes: 1 addition & 1 deletion THIRD_PARTY
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
** Protobuf -- https://github.com/golang/protobuf
** Protobuf -- https://github.com/protocolbuffers/protobuf-go
Copyright 2010 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
Loading