{"id":15690925,"url":"https://github.com/crazy-max/gotestlist","last_synced_at":"2025-05-07T03:25:00.588Z","repository":{"id":38417495,"uuid":"499458565","full_name":"crazy-max/gotestlist","owner":"crazy-max","description":"List tests in the given Go packages","archived":false,"fork":false,"pushed_at":"2024-09-12T06:15:08.000Z","size":54,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-10-18T07:32:15.341Z","etag":null,"topics":["golang","test"],"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/crazy-max.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"crazy-max","custom":"https://www.paypal.me/crazyws"}},"created_at":"2022-06-03T09:47:37.000Z","updated_at":"2024-06-23T11:12:45.000Z","dependencies_parsed_at":"2024-10-20T19:51:03.657Z","dependency_job_id":null,"html_url":"https://github.com/crazy-max/gotestlist","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fgotestlist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fgotestlist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fgotestlist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazy-max%2Fgotestlist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crazy-max","download_url":"https://codeload.github.com/crazy-max/gotestlist/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252805317,"owners_count":21806974,"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":["golang","test"],"created_at":"2024-10-03T18:17:46.184Z","updated_at":"2025-05-07T03:25:00.580Z","avatar_url":"https://github.com/crazy-max.png","language":"Go","funding_links":["https://github.com/sponsors/crazy-max","https://www.paypal.me/crazyws"],"categories":[],"sub_categories":[],"readme":"[![PkgGoDev](https://img.shields.io/badge/go.dev-docs-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/crazy-max/gotestlist)\n[![Test workflow](https://img.shields.io/github/actions/workflow/status/crazy-max/gotestlist/test.yml?label=test\u0026logo=github\u0026style=flat-square)](https://github.com/crazy-max/gotestlist/actions?workflow=test)\n[![Go Report](https://goreportcard.com/badge/github.com/crazy-max/gotestlist?style=flat-square)](https://goreportcard.com/report/github.com/crazy-max/gotestlist)\n[![Codecov](https://img.shields.io/codecov/c/github/crazy-max/gotestlist?logo=codecov\u0026style=flat-square)](https://codecov.io/gh/crazy-max/gotestlist)\n\n## About\n\nList tests in the given Go packages.\n\n## Installation\n\n```console\n$ go install github.com/crazy-max/gotestlist/cmd/gotestlist@latest\n```\n\n## Usage\n\n```console\n$ gotestlist .\ngotestlist     TestTests     /home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\n```\n\n```console\n$ gotestlist ./...\ngotestlist     TestTests     /home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\nmain           TestDirs      /home/crazy/src/github.com/crazy-max/gotestlist/cmd/gotestlist/gotestlist_test.go\n```\n\n```console\n$ gotestlist github.com/crazy-max/gotestlist\ngotestlist     TestTests     /home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\n```\n\n```console\n$ gotestlist github.com/crazy-max/gotestlist/...\ngotestlist     TestTests     /home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\nmain           TestDirs      /home/crazy/src/github.com/crazy-max/gotestlist/cmd/gotestlist/gotestlist_test.go\n```\n\n```console\n$ gotestlist github.com/crazy-max/gotestlist github.com/crazy-max/gotestlist/cmd/gotestlist\ngotestlist     TestTests     /home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\nmain           TestDirs      /home/crazy/src/github.com/crazy-max/gotestlist/cmd/gotestlist/gotestlist_test.go\n```\n\n```console\n$ gotestlist -f json ./... | jq\n[\n  {\n    \"name\": \"TestTests\",\n    \"benchmark\": false,\n    \"fuzz\": false,\n    \"suite\": \"\",\n    \"file\": \"/home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\",\n    \"pkg\": \"gotestlist\"\n  },\n  {\n    \"name\": \"TestDirs\",\n    \"benchmark\": false,\n    \"fuzz\": false,\n    \"suite\": \"\",\n    \"file\": \"/home/crazy/src/github.com/crazy-max/gotestlist/cmd/gotestlist/gotestlist_test.go\",\n    \"pkg\": \"main\"\n  }\n]\n```\n\n```console\n$ gotestlist -f \"Pkg: {{.Pkg}} | TestName: {{.Name}} | File: {{.File}}\" ./...\nPkg:     gotestlist     |     TestName:     TestTests     |     File:     /home/crazy/src/github.com/crazy-max/gotestlist/gotestlist_test.go\nPkg:     main           |     TestName:     TestDirs      |     File:     /home/crazy/src/github.com/crazy-max/gotestlist/cmd/gotestlist/gotestlist_test.go\n```\n\n```console\n$ gotestlist -d 1 ./...\n[\"TestDirs|TestTests\"]\n```\n\n```console\n$ gotestlist -d 2 ./...\n[\"TestDirs\",\"TestTests\"]\n```\n\n### Distribute tests with GitHub Actions\n\n`-d `flag dynamically distributes the tests based on the given matrix size and\nnumber of tests found. This JSON output can then be used as [matrix input](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs)\nin a GitHub Action workflow:\n\n```yaml\nname: test\n\non:\n  push:\n\nenv:\n  GO_VERSION: 1.23\n\njobs:\n  test-prepare:\n    runs-on: ubuntu-latest\n    outputs:\n      matrix: ${{ steps.tests.outputs.matrix }}\n    steps:\n      -\n        name: Checkout\n        uses: actions/checkout@v4\n      -\n        name: Set up Go\n        uses: actions/setup-go@v5\n        with:\n          go-version: ${{ env.GO_VERSION }}\n      -\n        name: Install gotestlist\n        run:\n          go install github.com/crazy-max/gotestlist/cmd/gotestlist@latest\n      -\n        name: Create matrix\n        id: tests\n        run: |\n          matrix=\"$(gotestlist -d 4 ./...)\"\n          echo \"matrix=$matrix\" \u003e\u003e $GITHUB_OUTPUT\n  \n  test:\n    runs-on: ubuntu-latest\n    needs:\n      - test-prepare\n    strategy:\n      fail-fast: false\n      test: ${{ fromJson(needs.test-prepare.outputs.matrix) }}\n    steps:\n      -\n        name: Checkout\n        uses: actions/checkout@v4\n      -\n        name: Set up Go\n        uses: actions/setup-go@v5\n        with:\n          go-version: ${{ env.GO_VERSION }}\n      -\n        name: Test\n        run: |\n          go test -run=(${{ matrix.test }})/ -coverprofile=coverage.txt -covermode=atomic ./...\n      -\n        name: Upload coverage\n        uses: codecov/codecov-action@v5\n        with:\n          files: ./coverage.txt\n```\n\nThis is useful if you have a lot of tests, and you want to distribute them to\nreduce build time.\n\n## Contributing\n\nWant to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. You\ncan also support this project by [**becoming a sponsor on GitHub**](https://github.com/sponsors/crazy-max) or by making\na [Paypal donation](https://www.paypal.me/crazyws) to ensure this journey continues indefinitely!\n\nThanks again for your support, it is much appreciated! :pray:\n\n## License\n\nMIT. See `LICENSE` for more details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazy-max%2Fgotestlist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrazy-max%2Fgotestlist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazy-max%2Fgotestlist/lists"}