{"id":19331325,"url":"https://github.com/andriykalashnykov/go-csv-struct","last_synced_at":"2026-06-13T04:32:35.068Z","repository":{"id":254151657,"uuid":"845641027","full_name":"AndriyKalashnykov/go-csv-struct","owner":"AndriyKalashnykov","description":"Go Package to convert CSV fields to Struct","archived":false,"fork":false,"pushed_at":"2026-03-29T14:36:34.000Z","size":316,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T17:33:29.959Z","etag":null,"topics":["csv","go","golang","parser","struct"],"latest_commit_sha":null,"homepage":"","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/AndriyKalashnykov.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-21T16:31:30.000Z","updated_at":"2026-03-29T14:36:37.000Z","dependencies_parsed_at":"2024-09-10T07:15:10.800Z","dependency_job_id":"b97ad597-f027-4d11-a409-b7ca6ba8de53","html_url":"https://github.com/AndriyKalashnykov/go-csv-struct","commit_stats":null,"previous_names":["andriykalashnykov/go-csv-struct"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/AndriyKalashnykov/go-csv-struct","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndriyKalashnykov%2Fgo-csv-struct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndriyKalashnykov%2Fgo-csv-struct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndriyKalashnykov%2Fgo-csv-struct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndriyKalashnykov%2Fgo-csv-struct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AndriyKalashnykov","download_url":"https://codeload.github.com/AndriyKalashnykov/go-csv-struct/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AndriyKalashnykov%2Fgo-csv-struct/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34272603,"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-13T02:00:06.617Z","response_time":62,"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":["csv","go","golang","parser","struct"],"created_at":"2024-11-10T02:39:42.877Z","updated_at":"2026-06-13T04:32:35.059Z","avatar_url":"https://github.com/AndriyKalashnykov.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![CI](https://github.com/AndriyKalashnykov/go-csv-struct/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/AndriyKalashnykov/go-csv-struct/actions/workflows/ci.yml)\n[![Hits](https://hits.sh/github.com/AndriyKalashnykov/go-csv-struct.svg?view=today-total\u0026style=plastic)](https://hits.sh/github.com/AndriyKalashnykov/go-csv-struct/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n[![Renovate enabled](https://img.shields.io/badge/renovate-enabled-brightgreen.svg)](https://app.renovatebot.com/dashboard#github/AndriyKalashnykov/go-csv-struct)\n\n# go-csv-struct\n\nA Go library that converts CSV records into Go structs using reflection and `csv` struct tags. It supports nested structs and the types: `string`, `int`, `bool`, `float32`, `float64`. Fields without a `csv` tag are skipped.\n\n## Quick Start\n\n```bash\nmake deps      # install tool dependencies\nmake build     # compile the project\nmake test      # run tests with coverage\nmake run       # run the example application\n```\n\n## Prerequisites\n\n| Tool | Version | Purpose |\n|------|---------|---------|\n| [GNU Make](https://www.gnu.org/software/make/) | 3.81+ | Build orchestration |\n| [Git](https://git-scm.com/) | 2.0+ | Version control |\n| [curl](https://curl.se/) | any | Downloading tools |\n| [gvm](https://github.com/moovweb/gvm) | latest | Go version management (auto-installed by `make deps`) |\n| [Go](https://go.dev/dl/) | 1.26+ | Go runtime and compiler (installed via gvm) |\n| [act](https://github.com/nektos/act) | 0.2.87+ | Local GitHub Actions execution (optional) |\n\nInstall all required tool dependencies:\n\n```bash\nmake deps\n```\n\n## Usage\n\nSee the complete runnable example in [`example/`](example/).\n\n```go\npackage main\n\nimport (\n\t\"encoding/csv\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\n\tcsvtostruct \"github.com/AndriyKalashnykov/csvtostruct\"\n)\n\ntype Record struct {\n\tName  string  `csv:\"name\"`\n\tAge   int     `csv:\"age\"`\n\tScore float64 `csv:\"score\"`\n}\n\nfunc main() {\n\tfile, err := os.Open(\"test.csv\")\n\tif err != nil {\n\t\tfmt.Println(\"error opening file:\", err)\n\t\treturn\n\t}\n\tdefer file.Close()\n\n\treader := csv.NewReader(file)\n\n\t// Read the header row\n\theaders, err := reader.Read()\n\tif err != nil {\n\t\tfmt.Println(\"error reading headers:\", err)\n\t\treturn\n\t}\n\n\t// Create a parser and validate headers\n\tparser, err := csvtostruct.NewCSVStructer(\u0026Record{}, headers)\n\tif err != nil {\n\t\tfmt.Println(\"error creating parser:\", err)\n\t\treturn\n\t}\n\tif !parser.ValidateHeaders(headers) {\n\t\tfmt.Println(\"CSV headers do not match struct tags\")\n\t\treturn\n\t}\n\n\t// Read and parse each data row\n\tfor {\n\t\trecord, err := reader.Read()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\t\tif err != nil {\n\t\t\tfmt.Println(\"error reading record:\", err)\n\t\t\tcontinue\n\t\t}\n\n\t\tvar r Record\n\t\tif err := parser.ScanStruct(record, \u0026r); err != nil {\n\t\t\tfmt.Println(\"parse error:\", err)\n\t\t\tcontinue\n\t\t}\n\t\tfmt.Printf(\"%+v\\n\", r)\n\t}\n}\n```\n\n## Available Make Targets\n\nRun `make help` to see all available targets.\n\n### Build \u0026 Run\n\n| Target | Description |\n|--------|-------------|\n| `make build` | Build and verify compilation |\n| `make run` | Run example application |\n| `make fmt` | Format Go files (gofumpt + gci) |\n| `make clean` | Clean up environment |\n\n### Code Quality\n\n| Target | Description |\n|--------|-------------|\n| `make lint` | Alias for static-check |\n| `make static-check` | Run all static analysis checks |\n| `make fmtcheck` | Check formatting without modifying files |\n| `make staticcheck` | Run staticcheck |\n| `make spellcheck` | Spell check |\n| `make critic` | Run gocritic |\n| `make sec` | Run gosec security scanner |\n| `make vulncheck` | Run Go vulnerability check on dependencies |\n| `make secrets` | Scan for hardcoded secrets in source code and git history |\n\n### Testing\n\n| Target | Description |\n|--------|-------------|\n| `make test` | Run tests with coverage |\n| `make coverage` | Run tests with HTML coverage report |\n| `make coverage-check` | Verify coverage meets 80% threshold |\n| `make fuzz` | Run fuzz tests for 30 seconds |\n\n### CI\n\n| Target | Description |\n|--------|-------------|\n| `make ci` | Run full CI pipeline locally |\n| `make ci-full` | Run full CI pipeline including coverage |\n| `make ci-run` | Run GitHub Actions workflow locally via [act](https://github.com/nektos/act) |\n| `make check` | Run pre-commit checklist |\n\n### Utilities\n\n| Target | Description |\n|--------|-------------|\n| `make deps` | Install all tool dependencies (pinned versions) |\n| `make deps-check` | Show required Go versions and gvm status |\n| `make deps-act` | Install act for local CI |\n| `make deps-prune` | Remove unused Go dependencies |\n| `make deps-prune-check` | Verify no prunable dependencies (CI gate) |\n| `make format` | Alias for fmt |\n| `make update` | Update dependency packages to latest versions |\n| `make release` | Create and push a new tag |\n| `make renovate-bootstrap` | Install nvm and npm for Renovate |\n| `make renovate-validate` | Validate Renovate configuration |\n\n## CI/CD\n\nGitHub Actions runs on every push to `main`, tags `v*`, and pull requests.\n\n| Job | Depends on | Steps |\n|-----|------------|-------|\n| **static-check** | — | Checkout (full history), Setup Go, Cache tools, Static check |\n| **build** | static-check | Checkout, Setup Go, Build |\n| **test** | static-check | Checkout, Setup Go, Cache tools, Coverage check (80%), Upload artifact |\n\nStatic check runs first (cheapest, fail-fast). Build and test run in parallel after static check passes.\n\nA separate [cleanup workflow](.github/workflows/cleanup-runs.yml) deletes old workflow runs weekly (retains 7 days, minimum 5 runs).\n\n[Renovate](https://docs.renovatebot.com/) keeps dependencies up to date with platform automerge enabled.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandriykalashnykov%2Fgo-csv-struct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandriykalashnykov%2Fgo-csv-struct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandriykalashnykov%2Fgo-csv-struct/lists"}