{"id":28629677,"url":"https://github.com/xpetit/x","last_synced_at":"2026-02-20T23:39:26.308Z","repository":{"id":41229063,"uuid":"475100107","full_name":"xpetit/x","owner":"xpetit","description":"A collection of functions to write concise code.","archived":false,"fork":false,"pushed_at":"2026-02-20T12:26:26.000Z","size":122,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-02-20T16:40:46.592Z","etag":null,"topics":["generics","go","golang","library"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/xpetit/x/v5","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/xpetit.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-03-28T17:04:56.000Z","updated_at":"2026-02-20T12:26:25.000Z","dependencies_parsed_at":"2023-11-11T15:27:05.528Z","dependency_job_id":"a0c0c813-2df5-4c69-ab0b-0066a249860c","html_url":"https://github.com/xpetit/x","commit_stats":null,"previous_names":[],"tags_count":42,"template":false,"template_full_name":null,"purl":"pkg:github/xpetit/x","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpetit%2Fx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpetit%2Fx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpetit%2Fx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpetit%2Fx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xpetit","download_url":"https://codeload.github.com/xpetit/x/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xpetit%2Fx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29667870,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T23:24:07.480Z","status":"ssl_error","status_checked_at":"2026-02-20T23:24:06.202Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["generics","go","golang","library"],"created_at":"2025-06-12T12:12:48.484Z","updated_at":"2026-02-20T23:39:26.286Z","avatar_url":"https://github.com/xpetit.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `x`\n\nA collection of functions to write concise code.\n\n```go\nsha2 := sha256.New()\nsrc := tar.NewReader(\n\tCloseAfterRead(Must(gzip.NewReader(\n\t\tio.TeeReader(\n\t\t\tCloseAfterRead(Must(http.Get(\"https://go.dev/dl/go1.20.2.linux-amd64.tar.gz\")).Body),\n\t\t\tsha2,\n\t\t),\n\t))),\n)\nfor th, err := src.Next(); err != io.EOF; th, err = src.Next() {\n\tCheck(err)\n\tswitch th.Typeflag {\n\tcase tar.TypeDir:\n\t\tCheck(os.Mkdir(th.Name, 0o755))\n\tcase tar.TypeReg:\n\t\tdst := Must(os.OpenFile(th.Name, os.O_CREATE|os.O_WRONLY, th.FileInfo().Mode()))\n\t\tMust(io.Copy(dst, src))\n\t\tCheck(dst.Close())\n\t}\n}\nAssert(hex.EncodeToString(sha2.Sum(nil)) == \"4eaea32f59cde4dc635fbc42161031d13e1c780b87097f4b4234cfce671f1768\")\n```\n\nThis snippet downloads an archive, unpacks it and verifies its checksum, all in one go.\nAny error causes a panic, cascading errors are stacked and each reader is closed as expected.\n\n---\n\nIf you get a warning from `gopls/staticcheck` about dot-import, create a file named `staticcheck.conf` in your project directory (or parents) with:\n\n```\ndot_import_whitelist = [ \"github.com/xpetit/x/v5\" ]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpetit%2Fx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxpetit%2Fx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxpetit%2Fx/lists"}