{"id":22814413,"url":"https://github.com/danlock/pkg","last_synced_at":"2026-02-02T11:03:02.487Z","repository":{"id":78566638,"uuid":"370419604","full_name":"Danlock/pkg","owner":"Danlock","description":"An opnionated collection of helper packages for making Go development easier  ","archived":false,"fork":false,"pushed_at":"2024-10-28T04:17:16.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-28T07:07:17.427Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Danlock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-05-24T16:37:21.000Z","updated_at":"2024-10-28T04:17:13.000Z","dependencies_parsed_at":"2023-06-26T00:50:26.376Z","dependency_job_id":"e5f1ab00-cd94-4f75-a5a4-7eb53d99399e","html_url":"https://github.com/Danlock/pkg","commit_stats":null,"previous_names":["danlock/pkg"],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danlock%2Fpkg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danlock%2Fpkg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danlock%2Fpkg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Danlock%2Fpkg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Danlock","download_url":"https://codeload.github.com/Danlock/pkg/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229388361,"owners_count":18065252,"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-12-12T13:08:50.575Z","updated_at":"2026-02-02T11:03:02.482Z","avatar_url":"https://github.com/Danlock.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pkg\n\n![Coverage](https://img.shields.io/badge/Coverage-55.1%25-yellow)\n[![Go Report Card](https://goreportcard.com/badge/github.com/danlock/pkg)](https://goreportcard.com/report/github.com/danlock/pkg)\n[![Go Reference](https://pkg.go.dev/badge/github.com/danlock/pkg.svg)](https://pkg.go.dev/github.com/danlock/pkg)\n\nA generic template I use when making new go projects,\nand a collection of small, helpful packages that I don't want to rewrite anymore.\n\n## errors\nPrefix the calling functions name to errors for simpler, smaller traces.\nThis package tries to split the difference between github.com/pkg/errors and Go stdlib errors, with first class support for log/slog.\n\n\nA full stack trace makes it harder to parse errors at a glance, especially if they are wrapped multiple times.\nBut relying only on the stdlib's fmt.Errorf will have you grepping through the codebase instead, which is not ideal.\n\n\nThis package encourages you to Wrap errors as they bubble up through the call stack. Wrapping multiple times won't punish you with stuttered stack traces.\nThey will only improve the error with more function names.\n\nAnd the resulting error will be self-explanatory... Or more realistically as explanatory your package and function names.\nhttps://go.dev/doc/effective_go#names is still great advice.\n\nThe error will also include the file:line info from the very first error in the chain.\n\nWrapAttr enables structured errors, allowing metadata to be easily included in logs.\nlog/slog support is built in. Slogging an error will include the file:line info from the start of an error chain and any metadata from WrapAttr calls.\n\nerrors/attr_test.go includes example output.\n\n## ptr\n\nptr.To and ptr.From have been recreated in every Go codebase dealing with openapi or protobuf code generation, even before generics.\nThey should probably be in the stdlib.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanlock%2Fpkg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanlock%2Fpkg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanlock%2Fpkg/lists"}