{"id":20598282,"url":"https://github.com/muja/goconfig","last_synced_at":"2025-04-15T00:17:11.782Z","repository":{"id":57512018,"uuid":"116495086","full_name":"muja/goconfig","owner":"muja","description":".gitconfig syntax parser","archived":false,"fork":false,"pushed_at":"2018-04-17T07:43:50.000Z","size":7,"stargazers_count":16,"open_issues_count":0,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T00:16:49.114Z","etag":null,"topics":["cfg","config","configuration","gitconfig","go","golang","parser","properties"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/muja.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}},"created_at":"2018-01-06T15:48:12.000Z","updated_at":"2023-04-25T13:55:16.000Z","dependencies_parsed_at":"2022-08-31T09:41:38.438Z","dependency_job_id":null,"html_url":"https://github.com/muja/goconfig","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/muja%2Fgoconfig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muja%2Fgoconfig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muja%2Fgoconfig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/muja%2Fgoconfig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/muja","download_url":"https://codeload.github.com/muja/goconfig/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248981270,"owners_count":21193147,"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":["cfg","config","configuration","gitconfig","go","golang","parser","properties"],"created_at":"2024-11-16T08:26:07.126Z","updated_at":"2025-04-15T00:17:11.752Z","avatar_url":"https://github.com/muja.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"goconfig\n========\n\n[![Travis Build Status](https://travis-ci.org/muja/goconfig.svg?branch=master)](https://travis-ci.org/muja/goconfig)\n\n# Table of contents\n\n1. Introduction\n2. Usage\n3. Contributing\n4. Reporting bugs\n\n-------------------\n\n# 1. Introduction\n\nThis project parses config files that have the same syntax as gitconfig files. It is a\nminimal parser, and maybe a writer sometime in the future. It has no knowledge of git-specific\nkeys and as such, does not provide any convenience methods like  `config.GetUserName()`.\nFor these, look into [go-gitconfig](https://github.com/tcnksm/go-gitconfig)\n\nMost of the code was copied and translated to Go from [git/config.c](https://github.com/git/git/blob/95ec6b1b3393eb6e26da40c565520a8db9796e9f/config.c)\n\n# 2. Usage\n\nCurrently, there is only one function: `Parse`.\n\n```go\nimport \"os/user\"\nimport \"path/filepath\"\nimport \"io/ioutil\"\nimport \"github.com/muja/goconfig\"\n\nuser, _ := user.Current()\n// don't forget to handle error!\ngitconfig := filepath.Join(user.HomeDir, \".gitconfig\")\nbytes, _ := ioutil.ReadFile(gitconfig)\n\nconfig, lineno, err := goconfig.Parse(bytes)\nif err != nil {\n  // Note: config is non-nil and contains successfully parsed values\n  log.Fatalf(\"Error on line %d: %v.\\n\", err)\n}\nfmt.Println(config[\"user.name\"])\nfmt.Println(config[\"user.email\"])\n```\n\n# 3. Contributing\n\nContributions are welcome! Fork -\u003e Push -\u003e Pull request.\n\n# 4. Bug report / suggestions\n\nJust create an issue! I will try to reply as soon as possible.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuja%2Fgoconfig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmuja%2Fgoconfig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmuja%2Fgoconfig/lists"}