{"id":20253994,"url":"https://github.com/frectonz/better-go","last_synced_at":"2025-08-27T07:04:35.142Z","repository":{"id":231490114,"uuid":"781582935","full_name":"frectonz/better-go","owner":"frectonz","description":"It's go but with try","archived":false,"fork":false,"pushed_at":"2024-04-18T19:15:56.000Z","size":364339,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"second-try","last_synced_at":"2025-04-10T23:51:22.824Z","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":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frectonz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-03T16:52:27.000Z","updated_at":"2025-01-10T03:38:48.000Z","dependencies_parsed_at":"2024-06-19T12:39:56.245Z","dependency_job_id":null,"html_url":"https://github.com/frectonz/better-go","commit_stats":null,"previous_names":["frectonz/better-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/frectonz/better-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fbetter-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fbetter-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fbetter-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fbetter-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frectonz","download_url":"https://codeload.github.com/frectonz/better-go/tar.gz/refs/heads/second-try","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fbetter-go/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265497464,"owners_count":23776992,"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-14T10:29:16.267Z","updated_at":"2025-07-16T08:33:11.715Z","avatar_url":"https://github.com/frectonz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# The Go Programming Language + `try` + `unwrap`\n\nGo with slightly better error handling primitives.\nCheckout the [demo](./demo) directory.\n\n## `try`\n\ntry sugar\n\n```golang\ncontent, err := ioutil.ReadFile(filename)\ntry err or string\n```\n\ntry desugared\n\n```golang\n...\nif err != nil {\n    return make([]string, 1)[0], err\n}\n```\n\nThe try statement expects two values.\n\n1. the error variable\n2. the type of the return value (this is needed because go has this convention of returning the zero value of a type incase of an error)\n\n## `unwrap`\n\nunwrap sugar\n\n```golang\nfileContent, err := readFile(\"sample.txt\")\nunwrap err\n```\n\nunwrap desugared\n\n```golang\n...\nif err != nil {\n    panic(err)\n}\n```\n\nThe unwrap statement expects one value, the error variable.\n\n## `bababooey`\n\njust like `try` but this doesn't need a type\n\n```golang\ncontent, err := ioutil.ReadFile(filename)\nbababooey err\n```\n\nbababooey desugared\n\n```golang\n...\nif err != nil {\n    return nil, err\n}\n```\n\nThe bababooey statement expects one value, the error variable.\n\n## `\u003c\u003c\u003c`\n\nsugar for `append`\n\n```golang\nnumbers := []int{1, 2, 3}\nnumbers = append(numbers, 4)\n```\n\nappend desugared\n\n```golang\nnumbers := []uint{1, 2, 3}\n@numbers \u003c\u003c\u003c 4\n```\n\n# How to run it\n\n```\nnix develop\ncd src\n./make.bash\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrectonz%2Fbetter-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrectonz%2Fbetter-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrectonz%2Fbetter-go/lists"}