{"id":13714428,"url":"https://github.com/thomasheller/gopath","last_synced_at":"2025-04-07T11:45:09.710Z","repository":{"id":72940365,"uuid":"86243794","full_name":"thomasheller/gopath","owner":"thomasheller","description":"Get GOPATH or default (Go 1.8+)","archived":false,"fork":false,"pushed_at":"2017-03-26T15:51:24.000Z","size":2,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T14:40:29.976Z","etag":null,"topics":["go","golang","gopath","home","home-directory"],"latest_commit_sha":null,"homepage":null,"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/thomasheller.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-03-26T15:37:15.000Z","updated_at":"2018-11-26T00:19:03.000Z","dependencies_parsed_at":"2023-05-26T03:47:10.243Z","dependency_job_id":null,"html_url":"https://github.com/thomasheller/gopath","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasheller%2Fgopath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasheller%2Fgopath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasheller%2Fgopath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thomasheller%2Fgopath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thomasheller","download_url":"https://codeload.github.com/thomasheller/gopath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247648923,"owners_count":20972942,"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":["go","golang","gopath","home","home-directory"],"created_at":"2024-08-02T23:01:59.292Z","updated_at":"2025-04-07T11:45:09.655Z","avatar_url":"https://github.com/thomasheller.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"# gopath\n\ngopath returns the current user's `GOPATH`, compatible with Go 1.8+\nThat is, it returns the value of the environment variable `GOPATH`,\nand if that is not set, the directory named `go` in the user's home\ndirectory.\n\nWhat \"home directory\" means is platform-specific. gopath uses\n[mitchellh/go-homedir](https://github.com/mitchellh/go-homedir) to\nfind out what the user's home directory is.\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/thomasheller/gopath\"\n)\n\nfunc main() {\n\tp, err := gopath.Get()\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting GOPATH: %v\", err)\n\t}\n\n\tfmt.Println(p)\n\n\t// Output:\n\t// /home/user/go (or whatever GOPATH is set)\n}\n```\n\nFor convenience, gopath also provides a function to join the `GOPATH`\nwith one or more path elements, like `filepath.Join`:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/thomasheller/gopath\"\n)\n\nfunc main() {\n\tp, err := gopath.Join(\"src/github.com/thomasheller/gopath\")\n\tif err != nil {\n\t\tlog.Fatalf(\"Error getting GOPATH: %v\", err)\n\t}\n\n\tfmt.Println(p)\n\n\t// Output:\n\t// /home/user/go/src/github.com/thomasheller/gopath (or whatever GOPATH is set)\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasheller%2Fgopath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthomasheller%2Fgopath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthomasheller%2Fgopath/lists"}