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

Drop unneed tasks & Check protoc generated contents #53

Merged
merged 24 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,16 @@ jobs:
name: Check generate
runs-on: ubuntu-latest
steps:
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
version: "27.x"
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
id: go
- name: make generate-ci
run: make generate-ci
- name: make generate
run: make generate && git diff --exit-code ':!*.pb'
18 changes: 7 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@ testcase:

PHONY: protoc
protoc:
protoc -I=/usr/local/include/ -I=. --go_out=plugins=grpc,paths=source_relative:. e2etest/dummyserver/echo.proto
protoc -I=/usr/local/include/ -I=. --go_out=plugins=grpc:${GOPATH}/src rerost/giro/hosts.proto
go install google.golang.org/protobuf/cmd/[email protected]
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.5.1

PHONY: generate-ci
generate-ci: setup
go mod tidy
go generate ./...
protoc -I=/usr/local/include/ -I=. --go_out=. --go-grpc_out=. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative e2etest/dummyserver/echo.proto
protoc -I=/usr/local/include/ -I=. --go_out=. --go-grpc_out=. --go_opt=paths=source_relative --go-grpc_opt=paths=source_relative rerost/giro/hosts.proto

PHONY: generate
generate: setup generate-ci testcase protoc
generate: setup testcase protoc
go generate ./...
go mod tidy

PHONY: build
build: setup generate
Expand All @@ -32,7 +32,3 @@ build: setup generate
PHONY: test
test:
go test -v ./...

.PHONY: mock
mock:
go generate ./...
2 changes: 1 addition & 1 deletion domain/host/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"

"github.com/pkg/errors"
hosts_pb "github.com/rerost/giro/pb/hosts"
hosts_pb "github.com/rerost/giro/rerost/giro"
)

type HostResolver interface {
Expand Down
95 changes: 3 additions & 92 deletions e2etest/dummyserver/echo.pb.go

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

121 changes: 121 additions & 0 deletions e2etest/dummyserver/echo_grpc.pb.go

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

8 changes: 6 additions & 2 deletions e2etest/dummyserver/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net"

"github.com/pkg/errors"
hosts_pb "github.com/rerost/giro/pb/hosts"
hosts_pb "github.com/rerost/giro/rerost/giro"
"google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
"google.golang.org/grpc/metadata"
Expand All @@ -19,7 +19,9 @@ func Run(port string) (func(), error) {
return runServer(port)
}

type testServiceServerImpl struct{}
type testServiceServerImpl struct {
UnimplementedTestServiceServer
}

func newTestService() TestServiceServer {
return &testServiceServerImpl{}
Expand Down Expand Up @@ -56,6 +58,8 @@ func NewHostsServiceServer() hosts_pb.HostServiceServer {
}

type hostsServiceServerImpl struct {
hosts_pb.UnimplementedHostServiceServer

hosts map[string]string
}

Expand Down
2 changes: 1 addition & 1 deletion example/multiple_package/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

.PHONY: protoc
protoc:
protoc --go_out=plugins=grpc,paths=source_relative:. --reflection-server_out=. $(shell find . -name '*.proto')
protoc --go-grpc_out=plugins=grpc,paths=source_relative:. --reflection-server_out=. $(shell find . -name '*.proto')
grpc_tools_ruby_protoc --ruby_out=$(PWD)/server --grpc_out=$(PWD)/server $(shell find . -name '*.proto')
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ require (
go.uber.org/zap v1.27.0
golang.org/x/tools v0.24.0
google.golang.org/grpc v1.65.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1
google.golang.org/protobuf v1.34.2
)

Expand Down Expand Up @@ -44,7 +45,7 @@ require (
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,12 @@ golang.org/x/tools v0.17.0/go.mod h1:xsh6VxdV005rRVaS6SSAf9oiAqljS7UZUacMZ8Bnsps
golang.org/x/tools v0.24.0 h1:J1shsA93PJUEVaUSaay7UXAyE8aimq3GW0pjlolpa24=
golang.org/x/tools v0.24.0/go.mod h1:YhNqVBIfWHdzvTLs0d8LCuMhkKUgSUKldakyV7W/WDQ=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 h1:1GBuWVLM/KMVUv1t1En5Gs+gFZCNd360GGb4sSxtrhU=
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0=
google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc=
google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
Loading