{"id":15874345,"url":"https://github.com/suzuki-shunsuke/go-ptr","last_synced_at":"2025-10-17T17:30:50.498Z","repository":{"id":40310338,"uuid":"129983815","full_name":"suzuki-shunsuke/go-ptr","owner":"suzuki-shunsuke","description":"golang library to convert a literal to pointer","archived":false,"fork":false,"pushed_at":"2024-02-27T11:33:47.000Z","size":121,"stargazers_count":1,"open_issues_count":27,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-15T01:18:27.589Z","etag":null,"topics":["golang","library","oss"],"latest_commit_sha":null,"homepage":"https://godoc.org/github.com/suzuki-shunsuke/go-ptr","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/suzuki-shunsuke.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2018-04-18T01:08:54.000Z","updated_at":"2022-02-09T06:34:22.000Z","dependencies_parsed_at":"2023-01-22T11:45:51.415Z","dependency_job_id":"4d0cc5cc-2508-478b-a620-06b21864f6cf","html_url":"https://github.com/suzuki-shunsuke/go-ptr","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzuki-shunsuke%2Fgo-ptr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzuki-shunsuke%2Fgo-ptr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzuki-shunsuke%2Fgo-ptr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suzuki-shunsuke%2Fgo-ptr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suzuki-shunsuke","download_url":"https://codeload.github.com/suzuki-shunsuke/go-ptr/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219869653,"owners_count":16555446,"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":["golang","library","oss"],"created_at":"2024-10-06T01:21:53.734Z","updated_at":"2025-10-17T17:30:45.186Z","avatar_url":"https://github.com/suzuki-shunsuke.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-ptr\n\n[![GoDoc](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)](http://godoc.org/github.com/suzuki-shunsuke/go-ptr)\n[![CircleCI](https://circleci.com/gh/suzuki-shunsuke/go-ptr.svg?style=svg)](https://circleci.com/gh/suzuki-shunsuke/go-ptr)\n[![codecov](https://codecov.io/gh/suzuki-shunsuke/go-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/suzuki-shunsuke/go-ptr)\n[![Go Report Card](https://goreportcard.com/badge/github.com/suzuki-shunsuke/go-ptr)](https://goreportcard.com/report/github.com/suzuki-shunsuke/go-ptr)\n[![GitHub last commit](https://img.shields.io/github/last-commit/suzuki-shunsuke/go-ptr.svg)](https://github.com/suzuki-shunsuke/go-ptr)\n[![GitHub tag](https://img.shields.io/github/tag/suzuki-shunsuke/go-ptr.svg)](https://github.com/suzuki-shunsuke/go-ptr/releases)\n[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/suzuki-shunsuke/go-ptr/master/LICENSE)\n\ngolang library to convert a literal to pointer.\n\nThis library is very trivial.\nIf there are any other ways to get a pointer of the literal value, please tell us.\n\n## Motivation\n\nSometimes we want to get a pointer of the literal value.\nBut the following code raises a compile error.\n\nhttps://play.golang.org/p/p9E9omKHogv\n\n```golang\npackage main\n\nimport (\n\t\"fmt\"\n)\n\nfunc main() {\n\tfmt.Println(\u0026\"hello\")\n}\n```\n\n```\nprog.go:8:14: cannot take the address of \"hello\"\n```\n\nSo we have to assign the literal to a variable.\n\n```golang\na := \"hello\"\nfmt.Println(\u0026a)\n```\n\nBut we want to write this at an one liner.\n\n```golang\nfmt.Println(ptr.PStr(\"hello\"))\n```\n\n## License\n\n[MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuzuki-shunsuke%2Fgo-ptr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuzuki-shunsuke%2Fgo-ptr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuzuki-shunsuke%2Fgo-ptr/lists"}