{"id":37135340,"url":"https://github.com/spatialcurrent/go-deadline","last_synced_at":"2026-01-14T15:47:06.381Z","repository":{"id":57554732,"uuid":"238463337","full_name":"spatialcurrent/go-deadline","owner":"spatialcurrent","description":"Library to create deadlines for goroutines and programs","archived":false,"fork":false,"pushed_at":"2020-02-05T15:02:55.000Z","size":5,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T15:49:08.329Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/spatialcurrent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-05T14:00:11.000Z","updated_at":"2020-02-09T22:13:12.000Z","dependencies_parsed_at":"2022-09-26T18:51:25.987Z","dependency_job_id":null,"html_url":"https://github.com/spatialcurrent/go-deadline","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/spatialcurrent/go-deadline","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-deadline","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-deadline/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-deadline/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-deadline/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatialcurrent","download_url":"https://codeload.github.com/spatialcurrent/go-deadline/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatialcurrent%2Fgo-deadline/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28424809,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T15:24:48.085Z","status":"ssl_error","status_checked_at":"2026-01-14T15:23:41.940Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-01-14T15:47:05.575Z","updated_at":"2026-01-14T15:47:06.370Z","avatar_url":"https://github.com/spatialcurrent.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/spatialcurrent/go-deadline/tree/master.svg?style=svg)](https://circleci.com/gh/spatialcurrent/go-deadline/tree/master) [![Go Report Card](https://goreportcard.com/badge/spatialcurrent/go-deadline)](https://goreportcard.com/report/spatialcurrent/go-deadline)  [![GoDoc](https://godoc.org/github.com/spatialcurrent/go-deadline?status.svg)](https://godoc.org/github.com/spatialcurrent/go-deadline) [![license](http://img.shields.io/badge/license-MIT-red.svg?style=flat)](https://github.com/spatialcurrent/go-deadline/blob/master/LICENSE)\n\n# go-deadline\n\n## Description\n\n**go-deadline** is a library to create deadlines for goroutines and programs.  This package is used as a safeguard to prevent a goroutine, test, or program from exhausting resources or otherwise running beyond the expected duration of time.  You can also use this library for automatically introducing some chaos into your container environment to test failover and network resilience.\n\n# Usage\n\n**Go**\n\nYou can import **go-deadline** as a library with:\n\n```go\nimport (\n  \"time\"\n  \"github.com/spatialcurrent/go-deadline/pkg/deadline\"\n)\n```\n\nYou can create a deadline near the start of your program.\n\n```go\nfunc main() {\n\n  ...\n\n  d, err := deadline.New(5*time.Second, deadline.ExitError)\n  if err != nil {\n    return fmt.Errorf(\"error creating deadline: %w\", err)\n  }\n  err := d.Start()\n  if err != nil {\n    return fmt.Errorf(\"error starting deadline: %w\", err)\n  }\n  // deadline is no running in a separate goroutine\n\n  ...\n}\n```\n\nIf you do not care to handle errors yourself, you can use the `deadline.MustStart` function with the default `deadline.ExitError` function.\n\n```go\nfunc main() {\n  ...\n  deadline.MustStart(context.Background(), 5*time.Second, deadline.ExitError)\n  ...\n}\n```\n\nAlternatively, if you wish to post a custom error to `stderr`, you can provide a custom function as below.\n\n```go\nfunc main() {\n  ...\n  deadline.MustStart(context.Background(), 5*time.Second, func(ctx context.Context) {\n    fmt.Fprintln(os.Stderr, \"deadline reached\")\n    os.Exit(1)\n  })\n  ...\n}\n```\n\nSee [deadline](https://godoc.org/github.com/spatialcurrent/go-deadline/pkg/deadline) in GoDoc for further API documentation.\n\n# Testing\n\nTo run Go tests use `make test_go` (or `bash scripts/test.sh`), which runs unit tests, `go vet`, `go vet with shadow`, [errcheck](https://github.com/kisielk/errcheck), [ineffassign](https://github.com/gordonklaus/ineffassign), [staticcheck](https://staticcheck.io/), and [misspell](https://github.com/client9/misspell).\n\n# Contributing\n\n[Spatial Current, Inc.](https://spatialcurrent.io) is currently accepting pull requests for this repository.  We'd love to have your contributions!  Please see [Contributing.md](https://github.com/spatialcurrent/go-deadline/blob/master/CONTRIBUTING.md) for how to get started.\n\n# License\n\nThis work is distributed under the **MIT License**.  See **LICENSE** file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatialcurrent%2Fgo-deadline","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatialcurrent%2Fgo-deadline","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatialcurrent%2Fgo-deadline/lists"}