{"id":24314902,"url":"https://github.com/karrick/gotb","last_synced_at":"2026-06-19T16:02:15.851Z","repository":{"id":57539169,"uuid":"150638852","full_name":"karrick/gotb","owner":"karrick","description":"Go library that implements a few tail buffer abstract data types.","archived":false,"fork":false,"pushed_at":"2018-09-27T19:44:59.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-25T04:04:12.267Z","etag":null,"topics":["golang","golang-library","library","text"],"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/karrick.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}},"created_at":"2018-09-27T19:39:36.000Z","updated_at":"2019-10-23T08:49:43.000Z","dependencies_parsed_at":"2022-09-11T14:42:01.784Z","dependency_job_id":null,"html_url":"https://github.com/karrick/gotb","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/karrick/gotb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karrick%2Fgotb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karrick%2Fgotb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karrick%2Fgotb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karrick%2Fgotb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karrick","download_url":"https://codeload.github.com/karrick/gotb/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karrick%2Fgotb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34538480,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-19T02:00:06.005Z","response_time":61,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["golang","golang-library","library","text"],"created_at":"2025-01-17T10:16:08.966Z","updated_at":"2026-06-19T16:02:15.811Z","avatar_url":"https://github.com/karrick.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gotb\n\nImplements a few tail buffer abstract data types.\n\n## Description\n\nTail buffers are useful when a program needs to track the N final\nelements added to a list, but not necessarily track previous elements.\n\n```Go\n// tail copies the final num lines from io.Reader to io.Writer.\nfunc tail(num int, r io.Reader, w io.Writer) error {\n\tcb, err := gotb.NewStrings(num)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tscanner := bufio.NewScanner(r)\n\n\tfor scanner.Scan() {\n\t\t_, _ = cb.QueueDequeue(scanner.Text())\n\t}\n\n\tif err := scanner.Err(); err != nil {\n\t\treturn err\n\t}\n\n\tfor _, line := range cb.Drain() {\n\t\tif _, err = fmt.Fprintln(w, line); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\treturn nil\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarrick%2Fgotb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarrick%2Fgotb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarrick%2Fgotb/lists"}