{"id":19750910,"url":"https://github.com/sheepla/tdloader","last_synced_at":"2025-07-06T03:35:49.635Z","repository":{"id":65536663,"uuid":"591734194","full_name":"sheepla/tdloader","owner":"sheepla","description":"A go module for easily loading test data placed in the Git repository","archived":false,"fork":false,"pushed_at":"2023-01-21T18:30:01.000Z","size":5,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-10T21:30:09.111Z","etag":null,"topics":[],"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/sheepla.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":"2023-01-21T17:41:17.000Z","updated_at":"2023-01-22T01:00:22.000Z","dependencies_parsed_at":"2023-02-12T12:01:56.169Z","dependency_job_id":null,"html_url":"https://github.com/sheepla/tdloader","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/sheepla%2Ftdloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Ftdloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Ftdloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheepla%2Ftdloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheepla","download_url":"https://codeload.github.com/sheepla/tdloader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241080660,"owners_count":19906324,"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":[],"created_at":"2024-11-12T02:40:48.022Z","updated_at":"2025-02-28T00:48:15.191Z","avatar_url":"https://github.com/sheepla.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tdloader\n\nA go module for easily loading test data placed in the Git repository\n\n## About\n\nThis module makes it easy to loading the test data placed in the Go repository.\nYou can load test data simply by specifying a relative path from the Git repository root e.g. `testdata := tdloader.GetFile(\"_testdata/data1.json\")`\n\nThe following functions can be used to load test data.\n\n- `GetPath` - Resolve full path of test data\n- `GetFile` - Open test data file and get `*os.File`. Since the `os.File` type implements the `func (f *File) Read(b []byte) (n int, err error)` method, it can also be treated as the `io.Reder` type.\n- `GetBytes` - Get the contents of the test data file as a bytes.\n- `GetString` - Get the contents of the test data file as a string\n\nFunction names prefixed with `Must` will panic when an error occurs.\n\n## Usage\n\n```go\n// mypkg.go\npackage mypkg\n\nfunc DoSomethingWithFile(f *os.File) error {\n    // -- snip --\n}\n```\n\n```go\n// mypkg_test.go\npackage mypkg\n\nimport (\n    \"testing\"\n    \"github.com/sheepla/tdloader\"\n)\n\nfunc TestDoSomething(t *testing.T) {\n    testdata := tdloader.GetFile(\"_testdata/data1.json\")\n    if err := DoSomethingWithFile(testdata); err != nil {\n        t.Fatal(err)\n    }\n\n    // -- snip --\n}\n```\n\n## Installation\n\n```sh\ngo get github.com/sheepla/tdloader\n```\n\n## Notice\n\nThis module runs a `git` command to find the project root directory. When using it, it is necessary that Git is installed and that the repository is managed by Git.\n\n## License\n\n[MIT](https://github.com/sheepla/tdloader/blob/master/LICENSE)\n\n## Author\n\n[sheepla](https://github.com/sheepla)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheepla%2Ftdloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheepla%2Ftdloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheepla%2Ftdloader/lists"}