{"id":20766139,"url":"https://github.com/navono/gokit-todo","last_synced_at":"2025-07-08T00:15:35.734Z","repository":{"id":74496686,"uuid":"146176867","full_name":"navono/gokit-todo","owner":"navono","description":"A sample demo with go-kit","archived":false,"fork":false,"pushed_at":"2018-08-31T02:08:26.000Z","size":4761,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T03:36:25.207Z","etag":null,"topics":["gokit","golang"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/navono.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":"2018-08-26T12:01:32.000Z","updated_at":"2018-08-31T02:08:27.000Z","dependencies_parsed_at":"2023-07-14T06:45:18.781Z","dependency_job_id":null,"html_url":"https://github.com/navono/gokit-todo","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fgokit-todo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fgokit-todo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fgokit-todo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/navono%2Fgokit-todo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/navono","download_url":"https://codeload.github.com/navono/gokit-todo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243093948,"owners_count":20235465,"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":["gokit","golang"],"created_at":"2024-11-17T11:21:34.971Z","updated_at":"2025-03-11T18:48:21.465Z","avatar_url":"https://github.com/navono.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-kit-demo\n演示`Go-Kit`的示例代码。\n\n# dev Environment\n下载包时，需要科学上网，同时设置`http_proxy`和`https_proxy`。比如在`PowerShell`中：\n\u003e $env:http_proxy=\"http://127.0.0.1:1080\"\n\u003cbr\u003e\n\u003e $env:https_proxy=\"http://127.0.0.1:1080\"\n\n然后再运行以下命令。\n\n## 下载`GoKit CLI`\n这个是一个命令行工具，用来产生`go-kit`可用的模板代码：\n\u003e go get github.com/kujtimiihoxha/kit\n\n## 安装\n\u003e go install github.com/kujtimiihoxha/kit\n\n## 依赖\n\u003e dep ensure -add -v github.com/go-kit/kit\n\n# 创建服务\n## 生成服务模板\n\u003e kit new service todo\n\n## 定义 endpoint\n```\npkg\n  io\n    io.go\n```\n使用`mongodb`来存储。然后在 `service.go` 中定义`endpoints`的接口：\n```go\n// TodoService describes the service.\ntype TodoService interface {\n\tGet(ctx context.Context) (t []io.Todo, error error)\n\tAdd(ctx context.Context, todo io.Todo) (t io.Todo, error error)\n\tSetComplete(ctx context.Context, id string) (error error)\n\tRemoveComplete(ctx context.Context, id string) (error error)\n\tDelete(ctx context.Context, id string) (error error)\n}\n```\n\n# 生成服务代码\n使用`Gorilla`作为默认的`http` handler。\n\u003e kit g s todo -w --gorilla\n\n安装依赖：\n\u003e dep ensure\n\n# 运行\n\u003e go run todo/cmd/main.go\n\n如果出现以下错误：\n\u003e #github.com/navono/go-kit-demo/vendor/github.com/openzipkin/zipkin-go-opentracing/thrift/gen-go/scribe\n\u003e vendor\\github.com\\openzipkin\\zipkin-go-opentracing\\thrift\\gen-go\\scribe\\scribe.go:283:14: too many arguments in call to oprot.Flush\n\n在`Gopkg.toml`中，增加以下字段：\n\u003e[[override]]\n  name = \"github.com/apache/thrift\"\n  version = \"master\"\n\n# 存储（DB）\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavono%2Fgokit-todo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnavono%2Fgokit-todo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnavono%2Fgokit-todo/lists"}