{"id":22332736,"url":"https://github.com/xgfone/go-pools","last_synced_at":"2026-03-05T07:33:57.970Z","repository":{"id":57516746,"uuid":"236003955","full_name":"xgfone/go-pools","owner":"xgfone","description":"A collection of some pools, such as BufferPool, BytesPool and TaskPool.","archived":false,"fork":false,"pushed_at":"2024-08-20T15:14:57.000Z","size":45,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-29T20:36:10.912Z","etag":null,"topics":["go","go-pool","go-pools","golang","object","object-pool","pool","pools"],"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/xgfone.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":"2020-01-24T13:03:27.000Z","updated_at":"2024-08-20T14:40:59.000Z","dependencies_parsed_at":"2025-07-29T19:38:07.214Z","dependency_job_id":"215864bb-d7a4-4df2-ae09-aa0257b1fa8b","html_url":"https://github.com/xgfone/go-pools","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/xgfone/go-pools","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-pools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-pools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-pools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-pools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xgfone","download_url":"https://codeload.github.com/xgfone/go-pools/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xgfone%2Fgo-pools/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30114309,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"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":["go","go-pool","go-pools","golang","object","object-pool","pool","pools"],"created_at":"2024-12-04T04:19:32.321Z","updated_at":"2026-03-05T07:33:57.944Z","avatar_url":"https://github.com/xgfone.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-pools [![Build Status](https://github.com/xgfone/go-pools/actions/workflows/go.yml/badge.svg)](https://github.com/xgfone/go-pools/actions/workflows/go.yml) [![GoDoc](https://pkg.go.dev/badge/github.com/xgfone/go-pools)](https://pkg.go.dev/github.com/xgfone/go-pools) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://raw.githubusercontent.com/xgfone/go-pools/master/LICENSE)\n\nProvide an object pool based on the generics supporting `Go1.18+`, such as `Pool`, `CapPool`.\n\n\n## Install\n```shell\n$ go get -u github.com/xgfone/go-pools\n```\n\n\n## Example\n\n#### `Pool`\n```go\ntype Context struct {\n    // ....\n}\npool := New(func() *Context { return new(Context) })\n\n// Get the context from the pool.\nctx := pool.Get()\n\n// Use the object as *Context to do something.\nfmt.Println(ctx.Object) // ctx.Object =\u003e *Context\n// ...\n\n// Release the context into the pool.\nctx.Release()\n\n// Output:\n// \u0026{}\n```\n\n#### `CapPool`\n```go\n// For *bytes.Buffer\nbufferPool := NewCapPool(\n    func(cap int) *bytes.Buffer { return bytes.NewBuffer(make([]byte, 0, cap)) }, // new\n    func(buf *bytes.Buffer) *bytes.Buffer { buf.Reset(); return buf },            // reset\n)\n\nbuffer := bufferPool.Get(1024)\n// TODO ...\nbuffer.Release()\n\n// For a slice, such as []byte or []interface{}\nslicePool := NewCapPool(\n    func(cap int) []byte { return make([]byte, 0, cap) }, // new\n    func(buf []byte) []byte { return buf[:0] },           // reset\n)\n\nbytes := slicePool.Get(128)\n// TODO ...\nbytes.Release()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxgfone%2Fgo-pools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxgfone%2Fgo-pools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxgfone%2Fgo-pools/lists"}