{"id":40548972,"url":"https://github.com/helloworlddan/run","last_synced_at":"2026-01-20T23:43:04.739Z","repository":{"id":243372583,"uuid":"812207449","full_name":"helloworlddan/run","owner":"helloworlddan","description":"Package Run provides useful, yet opinionated integrations for workloads running on Cloud Run.","archived":false,"fork":false,"pushed_at":"2025-06-03T14:54:36.000Z","size":173,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-03T22:13:04.873Z","etag":null,"topics":["cloud-run","cloud-run-jobs","cloud-run-services","gce-metadata","go","google-cloud","knative-serving"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/helloworlddan.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,"zenodo":null}},"created_at":"2024-06-08T08:37:10.000Z","updated_at":"2025-06-03T14:54:37.000Z","dependencies_parsed_at":"2025-06-09T06:47:22.617Z","dependency_job_id":null,"html_url":"https://github.com/helloworlddan/run","commit_stats":null,"previous_names":["helloworlddan/run"],"tags_count":34,"template":false,"template_full_name":null,"purl":"pkg:github/helloworlddan/run","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworlddan%2Frun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworlddan%2Frun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworlddan%2Frun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworlddan%2Frun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/helloworlddan","download_url":"https://codeload.github.com/helloworlddan/run/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/helloworlddan%2Frun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28618803,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T22:24:05.405Z","status":"ssl_error","status_checked_at":"2026-01-20T22:20:31.342Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["cloud-run","cloud-run-jobs","cloud-run-services","gce-metadata","go","google-cloud","knative-serving"],"created_at":"2026-01-20T23:43:04.669Z","updated_at":"2026-01-20T23:43:04.734Z","avatar_url":"https://github.com/helloworlddan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Run\n\nPackage Run provides useful, yet opinionated integrations for workloads running\non Cloud Run. It loosely follows the\n[general development tips](https://cloud.google.com/run/docs/tips/general) from\nthe official documentation.\n\n## Cloud Run Services\n\n### HTTP Services\n\nRead more in\n[run-examples](https://github.com/helloworlddan/run-examples/tree/main/run-http-service).\n\n```golang\npackage main\n\nimport (\n \"context\"\n \"fmt\"\n \"net/http\"\n\n \"cloud.google.com/go/bigquery\"\n \"github.com/helloworlddan/run\"\n)\n\nfunc main() {\n http.HandleFunc(\"/\", indexHandler)\n\n // Store config\n run.PutConfig(\"some-key\", \"some-val\")\n\n // Store client with lazy initialization\n var bqClient *bigquery.Client\n run.LazyClient(\"bigquery\", func() {\n  run.Debug(nil, \"lazy init: bigquery\")\n  var err error\n  ctx := context.Background()\n  bqClient, err = bigquery.NewClient(ctx, run.ProjectID())\n  if err != nil {\n   run.Error(nil, err)\n  }\n  run.Client(\"bigquery\", bqClient)\n })\n\n // Define shutdown behavior and serve HTTP\n err := run.ServeHTTP(func(ctx context.Context) {\n  run.Debug(nil, \"shutting down connections...\")\n  if bqClient != nil { // Maybe nil due to lazy loading\n   bqClient.Close()\n  }\n  run.Debug(nil, \"connections closed\")\n }, nil)\n if err != nil {\n  run.Fatal(nil, err)\n }\n}\n\nfunc indexHandler(w http.ResponseWriter, r *http.Request) {\n fmt.Fprintf(w, \"Name: %s\\n\", run.ServiceName())\n fmt.Fprintf(w, \"Revision: %s\\n\", run.ServiceRevision())\n fmt.Fprintf(w, \"ProjectID: %s\\n\", run.ProjectID())\n\n // Access config\n cfg, err := run.GetConfig(\"some-key\")\n if err != nil {\n  run.Error(r, err)\n }\n\n // Access client\n var client *bigquery.Client\n client, err = run.UseClient(\"bigquery\", client)\n if err != nil {\n  run.Error(nil, err)\n }\n // NOTE: use client\n _ = client\n\n fmt.Fprintf(w, \"Config[some-key]: %s\\n\", cfg)\n run.Debugf(r, \"request completed\")\n}\n```\n\n### GRPC Services\n\nRead more in\n[run-examples](https://github.com/helloworlddan/run-examples/tree/main/run-grpc-service).\n\n```golang\npackage main\n\nimport (\n \"context\"\n \"time\"\n\n \"github.com/helloworlddan/run\"\n \"github.com/helloworlddan/run-examples/run-grpc-service/runclock\"\n \"google.golang.org/grpc\"\n)\n\nfunc main() {\n server := grpc.NewServer()\n runclock.RegisterRunClockServer(server, clockServer{})\n\n err := run.ServeGRPC(func(ctx context.Context) {\n  run.Debug(nil, \"shutting down connections...\")\n  time.Sleep(time.Second * 1) // Pretending to clean up\n  run.Debug(nil, \"connections closed\")\n }, server)\n if err != nil {\n  run.Fatal(nil, err)\n }\n}\n\ntype clockServer struct {\n runclock.UnimplementedRunClockServer\n}\n\nfunc (srv clockServer) GetTime(ctx context.Context, in *runclock.Empty) (*runclock.Time, error) {\n now := time.Now()\n run.Debug(nil, \"received request\")\n return \u0026runclock.Time{\n  Formatted: now.GoString(),\n }, nil\n}\n```\n\nA client implementation can be found\n[here](https://github.com/helloworlddan/run-examples/tree/main/run-grpc-client).\n\n## Cloud Run Jobs\n\nRead more in\n[run-examples](https://github.com/helloworlddan/run-examples/tree/main/run-job).\n\n```golang\npackage main\n\nimport (\n \"context\"\n \"net/http\"\n\n \"cloud.google.com/go/bigquery\"\n \"github.com/helloworlddan/run\"\n)\n\nfunc main() {\n // Store config\n run.PutConfig(\"my.app.key\", \"some value\")\n cfgVal, err := run.GetConfig(\"my.app.key\")\n if err != nil {\n  run.Debugf(nil, \"unable to read config: %v\", err)\n }\n run.Infof(nil, \"loaded config: %s\", cfgVal)\n\n // Store client\n ctx := context.Background()\n bqClient, err := bigquery.NewClient(ctx, run.ProjectID())\n if err != nil {\n  run.Error(nil, err)\n }\n run.Client(\"bigquery\", bqClient)\n defer bqClient.Close()\n\n // Later usage\n var bqClient2 *bigquery.Client\n bqClient2, err = run.UseClient(\"bigquery\", bqClient2)\n if err != nil {\n  run.Error(nil, err)\n }\n\n _ = bqClient2\n\n // Make service account authenticated requests\n req, err := http.NewRequest(http.MethodGet, \"https://google.com\", nil)\n if err != nil {\n  run.Error(nil, err)\n }\n req = run.AddOAuth2Header(req)\n resp, err := http.DefaultClient.Do(req)\n if err != nil {\n  run.Error(nil, err)\n }\n defer resp.Body.Close()\n // read response\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloworlddan%2Frun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhelloworlddan%2Frun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhelloworlddan%2Frun/lists"}