{"id":20145120,"url":"https://github.com/terrastruct/util-go","last_synced_at":"2025-03-17T16:12:03.058Z","repository":{"id":64083457,"uuid":"559123724","full_name":"terrastruct/util-go","owner":"terrastruct","description":"General purpose go libraries.","archived":false,"fork":false,"pushed_at":"2025-02-13T17:43:39.000Z","size":2158,"stargazers_count":19,"open_issues_count":5,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-15T23:43:03.836Z","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":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/terrastruct.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}},"created_at":"2022-10-29T06:01:32.000Z","updated_at":"2025-02-13T17:43:43.000Z","dependencies_parsed_at":"2023-02-14T02:30:57.976Z","dependency_job_id":"47be052b-8787-473b-9c0d-4bb445499cba","html_url":"https://github.com/terrastruct/util-go","commit_stats":{"total_commits":131,"total_committers":6,"mean_commits":"21.833333333333332","dds":0.3129770992366412,"last_synced_commit":"55b3812542c2d288a3afe7486f663047358a2ff4"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrastruct%2Futil-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrastruct%2Futil-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrastruct%2Futil-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/terrastruct%2Futil-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/terrastruct","download_url":"https://codeload.github.com/terrastruct/util-go/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066189,"owners_count":20392406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-13T22:14:17.578Z","updated_at":"2025-03-17T16:12:03.039Z","avatar_url":"https://github.com/terrastruct.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# util-go\n\n[![godoc](https://pkg.go.dev/badge/oss.terrastruct.com/util-go.svg)](https://pkg.go.dev/oss.terrastruct.com/util-go)\n[![ci](https://github.com/terrastruct/util-go/actions/workflows/ci.yml/badge.svg)](https://github.com/terrastruct/util-go/actions/workflows/ci.yml)\n[![daily](https://github.com/terrastruct/util-go/actions/workflows/daily.yml/badge.svg)](https://github.com/terrastruct/util-go/actions/workflows/daily.yml)\n[![license](https://img.shields.io/github/license/terrastruct/util-go?color=9cf)](./LICENSE)\n\nTerrastruct's general purpose go libraries.\n\nSee https://pkg.go.dev/oss.terrastruct.com/util-go for docs.\n\nIf there's enough external demand for a single package to be split off into its\nown repo from this collection we will. Feel free to open an issue to request.\n\n\u003c!-- toc --\u003e\n- [./diff](#diff)\n- [./assert](#assert)\n- [./xdefer](#xdefer)\n- [./cmdlog](#cmdlog)\n- [./xterm](#xterm)\n- [./xos](#xos)\n- [./xrand](#xrand)\n- [./xcontext](#xcontext)\n- [./xjson](#xjson)\n- [./go2](#go2)\n- [./xbrowser](#xbrowser)\n- [./xexec](#xexec)\n- [./xhttp](#xhttp)\n- [./xmain](#xmain)\n- [./mapfs](#mapfs)\n\ngodoc is the canonical reference but we've provided this index as the godoc UI is frankly\ngarbage after the move to pkg.go.dev. It's nowhere near as clear and responsive as the old\nUI. If this feedback reaches the authors of pkg.go.dev, please revert the UI back to what\nit was with godoc.org.\n\n### [./diff](./diff)\n\ndiff providers functions to diff strings, files and general Go values with git diff.\n\n### [./assert](./assert)\n\nassert provides test assertion helpers. It integrates with [./diff](#diff) to display\nbeautiful diffs.\n\nnote: `TestdataJSON` is extremely useful.\n\n![example output](./diff/example.png)\n\n- Strings\n- Files\n- Runes\n- JSON\n- Testdata\n- TestdataJSON\n\n### [./xdefer](./xdefer)\n\nxdefer annotates all errors returned from a function transparently.\n\n### [./cmdlog](./cmdlog)\n\ncmdlog implements color leveled logging for command line tools.\n\n![example output](./cmdlog/example/example.png)\n\n`cmdlog` supports arbitrary randomly colored prefixes just like\n[terrastruct/ci](https://github.com/terrastruct/ci).\n\nExample is in [./cmdlog/example/main.go](./cmdlog/example/main.go).\n\nSee [./cmdlog/cmdlog_test.go](./cmdlog/cmdlog_test.go) for further usage.\n\nYou can log in tests with `NewTB`.\n\n- `$COLOR` is obeyed to force enable/disable colored output.\n- `$DEBUG` is obeyed to enable/disable debug logs.\n\n### [./xterm](./xterm)\n\nxterm implements outputting formatted text to a terminal.\n\n### [./xos](./xos)\n\nxos provides OS helpers.\n\n### [./xrand](./xrand)\n\nxrand provides helpers for generating useful random values.\nWe use it mainly for generating inputs to tests.\n\n### [./xcontext](./xcontext)\n\nxcontext implements indispensable context helpers.\n\n### [./xjson](./xjson)\n\nxjson implements basic JSON helpers.\n\n### [./go2](./go2)\n\ngo2 contains general utility helpers that should've been in Go. Maybe they'll be in Go 2.0.\n\n### [./xbrowser](./xbrowser)\n\nxbrowser enables opening a user's GUI browser to a URL.\n\n### [./xexec](./xexec)\n\nxexec provides exec helpers.\n\n### [./xhttp](./xhttp)\n\nxhttp provides HTTP helpers.\n\n### [./xmain](./xmain)\n\nxmain implements helpers for building CLI tools.\n\n### [./mapfs](./mapfs)\n\nPackage mapfs takes in a description of a filesystem as a `map[string]string` and writes it to a temp directory so that it may be used as an io/fs.FS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrastruct%2Futil-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fterrastruct%2Futil-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fterrastruct%2Futil-go/lists"}