{"id":50664454,"url":"https://github.com/marcuwynu23/godan","last_synced_at":"2026-06-08T05:02:43.320Z","repository":{"id":350847304,"uuid":"1208464304","full_name":"marcuwynu23/godan","owner":"marcuwynu23","description":"A Go library for DAN (Data Advanced Notation) — a human-readable data format for structured configs, datasets, and annotations, with tables, arrays, and comments.","archived":false,"fork":false,"pushed_at":"2026-04-12T11:41:58.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-12T13:11:44.521Z","etag":null,"topics":["dan","dan-py","godan"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/marcuwynu23/godan","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcuwynu23.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":null,"code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"custom":["https://paypal.me/wynumarcu23"]}},"created_at":"2026-04-12T10:16:07.000Z","updated_at":"2026-04-12T12:38:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/marcuwynu23/godan","commit_stats":null,"previous_names":["marcuwynu23/godan"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/marcuwynu23/godan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2Fgodan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2Fgodan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2Fgodan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2Fgodan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcuwynu23","download_url":"https://codeload.github.com/marcuwynu23/godan/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcuwynu23%2Fgodan/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34048681,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"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":["dan","dan-py","godan"],"created_at":"2026-06-08T05:02:39.726Z","updated_at":"2026-06-08T05:02:43.314Z","avatar_url":"https://github.com/marcuwynu23.png","language":"Go","funding_links":["https://paypal.me/wynumarcu23"],"categories":[],"sub_categories":[],"readme":"# DAN for Go (`godan`)\n\n**A Go library for [DAN](https://github.com/marcuwynu23/danjs) (Data Advanced Notation)** — a human-readable data format for structured **configs**, **datasets**, and **annotations**, with **tables**, **arrays**, and **comments**.\n\nThis package **parses** DAN text into Go values and **serializes** them back. The API is **`Decode`** and **`Encode`** on `map[string]interface{}` (nested maps, table rows as `[]map[string]interface{}`, arrays as `[]interface{}`, plus strings, numbers, and booleans). Line-oriented syntax includes **nested blocks** `{ … }`, **key–value** lines, **`table(col1, col2) [ … ]`**, and **`#` / `//` comments** during parse.\n\n---\n\n## Module and package\n\n|                     | Path                               |\n| ------------------- | ---------------------------------- |\n| **Go module**       | `github.com/marcuwynu23/godan`     |\n| **Library package** | `github.com/marcuwynu23/godan/lib` |\n\nImport the library as:\n\n```go\nimport \"github.com/marcuwynu23/godan/lib\"\n```\n\nThe `lib` package exposes **`Decode`** and **`Encode`** as the complete public surface for round-tripping DAN documents.\n\n---\n\n## Install\n\n```bash\ngo get github.com/marcuwynu23/godan\n```\n\nRequires **Go 1.23.5** or compatible toolchain (see `go.mod`).\n\n---\n\n## API overview\n\n### `Decode(text interface{}) (map[string]interface{}, error)`\n\n- **Input:** `string` or `[]byte`. Any other type returns an error.\n- **Output:** A single root `map[string]interface{}` representing the document. Empty or whitespace-only input yields an **empty map**, not an error.\n- **Model:** Nested objects are nested `map[string]interface{}`. Tables become **`[]map[string]interface{}`**. Arrays in values become **`[]interface{}`**. Scalars use `string`, `float64`, or `bool` as inferred from the text.\n\n### `Encode(obj map[string]interface{}) string`\n\n- **Input:** The same shape of data `Decode` produces (root must be a map).\n- **Output:** DAN text with **2-space indentation** for blocks and nested values. **`nil` map values** encode as **`\"\"`** (empty quoted string) so output stays valid DAN.\n- **Ordering:** Map iteration order in Go is **not stable**; key order in blocks and table column order in headers can differ between encodings of the same logical data.\n\n---\n\n## DAN constructs this library understands\n\n| Construct      | Example                            | Decoded shape (typical)         |\n| -------------- | ---------------------------------- | ------------------------------- |\n| Key–value      | `name: \"Ada\"`                      | `map` entry `string`            |\n| Number         | `port: 8080`                       | `float64`                       |\n| Boolean        | `tls: true`                        | `bool`                          |\n| Unquoted token | `env: production`                  | `string`                        |\n| Array value    | `tags: [a, b, c]`                  | `[]interface{}`                 |\n| Block          | `server { host: \"h\" }`             | nested `map[string]interface{}` |\n| Table          | `rows: table(id, name) [ 1, \"a\" ]` | `[]map[string]interface{}`      |\n| Comments       | `# …` or `// …`                    | stripped during parse           |\n\nTable rows are split on **commas**; values are trimmed and passed through the same literal rules as scalar fields.\n\n---\n\n## Usage examples\n\n### Minimal decode / encode\n\n```go\nimport \"github.com/marcuwynu23/godan/lib\"\n\nm, err := lib.Decode(`name: \"Ada\"`)\nif err != nil {\n    log.Fatal(err)\n}\nout := lib.Encode(m)\n```\n\n### From bytes\n\n```go\ndata, _ := os.ReadFile(\"config.dan\")\nm, err := lib.Decode(data)\n```\n\n### Nested document\n\n```go\nconst doc = `app {\n  name: \"demo\"\n  server {\n    port: 3000\n  }\n}`\nm, _ := lib.Decode(doc)\n// m[\"app\"].(map[string]interface{})[\"server\"] ...\n```\n\n---\n\n## Tests\n\n```bash\ngo test ./...\n```\n\nTests live under **`lib/`** (`*_test.go`, benchmarks, integration-style cases).\n\n---\n\n## Using this module in your project\n\n- Prefer **pinning** a version or commit in production (`go get` with version, or your workspace policy).\n- Treat decoded maps as **untrusted** until you validate fields for your application.\n- For **CLI** access to the same implementation, see [**dan-cli**](https://github.com/marcuwynu23/dan-cli). For **lint/format**, see [**danlint**](https://github.com/marcuwynu23/danlint). For the **JavaScript** package, see [**danjs**](https://github.com/marcuwynu23/danjs) ([`@marcuwynu23/danjs`](https://www.npmjs.com/package/@marcuwynu23/danjs)).\n\n---\n\n## Community\n\n- [Contributing](CONTRIBUTING.md)\n- [Code of Conduct](CODE_OF_CONDUCT.md)\n- [Security](SECURITY.md)\n- [Funding](.github/FUNDING.yml) — [PayPal](https://paypal.me/wynumarcu23) via the repository **Sponsor** button\n\n---\n\n## License\n\nSPDX and full license text are added when the repository is published for redistribution (commonly **MIT**). If no `LICENSE` file is present yet, coordinate with the maintainers before redistributing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuwynu23%2Fgodan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcuwynu23%2Fgodan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcuwynu23%2Fgodan/lists"}