{"id":21690620,"url":"https://github.com/reiver/go-opt","last_synced_at":"2026-02-12T06:31:58.677Z","repository":{"id":54751272,"uuid":"91724759","full_name":"reiver/go-opt","owner":"reiver","description":"Package opt implements an optional-type, for the Go programming language. In other programming languages, an optional-type might be know as: a option type, or a maybe type.","archived":false,"fork":false,"pushed_at":"2024-08-09T03:53:41.000Z","size":42,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-12T09:46:17.146Z","etag":null,"topics":["maybe-type","option-type","optional-type"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/reiver/go-opt","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/reiver.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":"2017-05-18T18:19:16.000Z","updated_at":"2024-10-03T23:56:51.000Z","dependencies_parsed_at":"2022-08-14T01:40:42.418Z","dependency_job_id":"43589e80-c38b-49b4-9300-101a427a1ef0","html_url":"https://github.com/reiver/go-opt","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/reiver/go-opt","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiver%2Fgo-opt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiver%2Fgo-opt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiver%2Fgo-opt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiver%2Fgo-opt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/reiver","download_url":"https://codeload.github.com/reiver/go-opt/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/reiver%2Fgo-opt/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29360644,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-12T01:03:07.613Z","status":"online","status_checked_at":"2026-02-12T02:00:06.911Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["maybe-type","option-type","optional-type"],"created_at":"2024-11-25T17:32:37.373Z","updated_at":"2026-02-12T06:31:58.663Z","avatar_url":"https://github.com/reiver.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-opt\n\nPackage **opt** implements an **optional-type**, for the Go programming language.\n\nIn other programming languages, an **optional-type** might be know as: a **option-type**, or a **maybe-type**.\n\n## Documention\n\nOnline documentation, which includes examples, can be found at: http://godoc.org/github.com/reiver/go-opt\n\n[![GoDoc](https://godoc.org/github.com/reiver/go-opt?status.svg)](https://godoc.org/github.com/reiver/go-opt)\n\n## Examples\n\nHere is an example **optional-type** that can hold a string:\n```go\nimport \"github.com/reiver/go-opt\"\n\n//\n\nvar op opt.Optional[string] // the default value is nothing.\n\n// ...\n\nif opt.Nothing[string]() == op {\n\tfmt.Println(\"nothing\")\n}\n\n// ...\n\nop = opt.Something(\"Hello world! 👾\")\n\n// ...\n\nswitch op {\ncase op.Nothing[string]():\n\t//@TODO\ncase op.Something(\"apple\"):\n\t//@TODO\ncase op.Something(\"banana\"):\n\t//@TODO\ncase op.Something(\"cherry\"):\n\t//@TODO\ndefault:\n\t//@TODO\n}\n\n// ...\n\nvalue, found := op.Get()\nif found {\n\tfmt.Println(\"VALUE:\", value)\n} else {\n\tfmt.Println(\"nothing\")\n}\n```\n\n## Import\n\nTo import package **opt** use `import` code like the follownig:\n```\nimport \"github.com/reiver/go-opt\"\n```\n\n## Installation\n\nTo install package **opt** do the following:\n```\nGOPROXY=direct go get https://github.com/reiver/go-opt\n```\n\n## Author\n\nPackage **opt** was written by [Charles Iliya Krempeaux](http://reiver.link)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freiver%2Fgo-opt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Freiver%2Fgo-opt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Freiver%2Fgo-opt/lists"}