{"id":26447580,"url":"https://github.com/abitofhelp/connect-go-example","last_synced_at":"2025-06-25T17:06:28.725Z","repository":{"id":241438169,"uuid":"805961702","full_name":"abitofhelp/connect-go-example","owner":"abitofhelp","description":"This repository contains a client/server solution implementing the classic Greet service using the following technologies:  Bazel, Buf, ConnectRPC, Go, and Protocol Buffers.","archived":false,"fork":false,"pushed_at":"2024-05-29T01:34:06.000Z","size":825,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-29T22:51:39.113Z","etag":null,"topics":["bazel","buf","bzlmod","connectrpc","example","gazelle","go","golang","grpc","health-check","healthcheck","reflection"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abitofhelp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-26T00:58:10.000Z","updated_at":"2024-05-29T01:34:10.000Z","dependencies_parsed_at":"2024-05-28T10:59:39.992Z","dependency_job_id":"ced2ecdd-d6a6-4a96-915a-c56995e164d5","html_url":"https://github.com/abitofhelp/connect-go-example","commit_stats":null,"previous_names":["abitofhelp/connect-go-example"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofhelp%2Fconnect-go-example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofhelp%2Fconnect-go-example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofhelp%2Fconnect-go-example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abitofhelp%2Fconnect-go-example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abitofhelp","download_url":"https://codeload.github.com/abitofhelp/connect-go-example/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244236077,"owners_count":20420753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","buf","bzlmod","connectrpc","example","gazelle","go","golang","grpc","health-check","healthcheck","reflection"],"created_at":"2025-03-18T13:57:48.583Z","updated_at":"2025-03-18T13:57:49.086Z","avatar_url":"https://github.com/abitofhelp.png","language":"Starlark","readme":"# connect-go-example\n\nThis repository contains a client/server solution implementing the classic  Greet service using the following technologies:\n* Bazel\n* Buf\n* ConnectRPC\n* Go\n* Grpc Health\n* Grpc Reflection\n* Protocol Buffers\n\n## File Generation\nThere are three ways to generate the Protocol Buffer and ConnectRPC files:\n\n1) protoc -I proto --go_out='gen/' --go_opt=paths=source_relative --connect-go_out='gen/' --connect-go_opt=paths=source_relative $(find proto -name '*.proto')\n\n2) buf generate proto\n\n3) bazel build\n    * bazel build //proto/greet/v1:greetv1_connect_go_proto \\\n      This command will generate the Protocol Buffers \u0026 Connect RPC files.\n    * bazel build //proto/greet/v1:greetv1_connect_go_proto \\\n      and \\\n      bazel build //proto/greet/v1:greetv1_go_proto \\\n      The first command generates the Protocol Buffer file. \\\n      The second command generates the ConnectRPC file. \\\n      It doesn't generate the Protocol Buffer file unless it has changed.\n\n## Build\nThere are two alternatives to build the solution depending on how you \\\ngenerated the Protocol Buffer and ConnectRPC files:\n1) Go Build From protoc or buf \\\n   go build ./...\n\n2) Bazel Build  \n   bazel build //...\n\n### IMPORTANT: If you want to build interchangeably using 'go build' or 'bazel build', the import paths in the generated files must be consistent.  Essentially, each path in the plugin's 'out' field must be the root of the importpath \u0026 overrideimportpath in the go_proto_library blocks in proto/greet/v1/BUILD.bazel. Here is an example from this repository's code showing proper alignment between the configuration files using a path starting at 'gen':\n\n```\n# buf.get.yaml (redacted to relevant fields) \nplugins:\n- remote: buf.build/protocolbuffers/go \n  out: gen/\n- remote: buf.build/connectrpc/go \n  out: gen/\n```\n\n```\n# proto/greet/v1/BUILD.bazel (redacted to relevant fields)\ngo_proto_library(\nname = \"greetv1_connect_go_proto\",\nimportpath = \"github.com/abitofhelp/connect-go-example/gen/greet/v1\",\noverrideimportpath = \"github.com/abitofhelp/connect-go-example/gen/greet/v1/greetv1connect\",\n)\n\ngo_proto_library(\nname = \"greetv1_go_proto\",\nimportpath = \"github.com/abitofhelp/connect-go-example/__gen__/greet/v1\",\n)\n```\n\n## GreetService Queries\n* grpcurl -plaintext -d '{\"name\": \"Jane\"}' localhost:8080 greet.v1.GreetService/Greet\n* grpcurl -plaintext -proto proto/greet/v1/greet.proto -d '{\"name\": \"Jane\"}' localhost:8080 greet.v1.GreetService/Greet\n* curl -X POST -H \"Content-Type: application/json\" -d '{\"name\": \"Jane\"}' http://127.0.0.1:8080/greet.v1.GreetService/Greet\n* buf curl --http2-prior-knowledge --schema=proto -d '{\"name\": \"Jane\"}' http://127.0.0.1:8080/greet.v1.GreetService/Greet\n\n## GreetService Health Queries\n* grpcurl -plaintext -d '{\"service\":\"greet.v1.GreetService\"}' localhost:8080 grpc.health.v1.Health/Check\n* curl -X POST -H \"Content-Type: application/json\" -d '{\"service\":\"greet.v1.GreetService\"}' http://127.0.0.1:8080/grpc.health.v1.Health/Check\n* buf curl --http2-prior-knowledge -d '{\"service\":\"greet.v1.GreetService\"}' http://127.0.0.1:8080/grpc.health.v1.Health/Check\n\n\n## Resources\n* https://connectrpc.com\n* https://github.com/connectrpc/connect-go\n* https://github.com/connectrpc/examples-go\n* https://github.com/connectrpc/grpchealth-go\n* https://github.com/connectrpc/grpcreflect-go","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabitofhelp%2Fconnect-go-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabitofhelp%2Fconnect-go-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabitofhelp%2Fconnect-go-example/lists"}