{"id":21064169,"url":"https://github.com/moveaxlab/dep-check","last_synced_at":"2026-01-24T20:53:32.808Z","repository":{"id":222656521,"uuid":"757510007","full_name":"moveaxlab/dep-check","owner":"moveaxlab","description":"Validate imports and run tests selectively in Go projects.","archived":false,"fork":false,"pushed_at":"2024-10-17T09:50:11.000Z","size":21,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-16T02:37:54.672Z","etag":null,"topics":["fitness-function","go","project-structure"],"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/moveaxlab.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}},"created_at":"2024-02-14T16:34:16.000Z","updated_at":"2024-10-17T09:48:47.000Z","dependencies_parsed_at":"2024-02-15T14:28:47.015Z","dependency_job_id":"a0ff81e8-902e-43d0-b1a4-2b07fee043c7","html_url":"https://github.com/moveaxlab/dep-check","commit_stats":null,"previous_names":["moveaxlab/dep-check"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/moveaxlab/dep-check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moveaxlab%2Fdep-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moveaxlab%2Fdep-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moveaxlab%2Fdep-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moveaxlab%2Fdep-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moveaxlab","download_url":"https://codeload.github.com/moveaxlab/dep-check/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moveaxlab%2Fdep-check/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28736791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T19:23:36.361Z","status":"ssl_error","status_checked_at":"2026-01-24T19:23:28.966Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["fitness-function","go","project-structure"],"created_at":"2024-11-19T17:48:37.222Z","updated_at":"2026-01-24T20:53:32.793Z","avatar_url":"https://github.com/moveaxlab.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dep check\n\nThis repo contains a tool to validate imports inside Go monorepos,\nand to run tests selectively based on changed files and imports structure.\n\n## Installation\n\n```bash\ngo install github.com/moveaxlab/dep-check\n```\n\n## Configuration\n\nThis tool distingueshes between 4 types of packages:\n\n- `external` is used for [vendored](https://go.dev/ref/mod#vendoring) external dependencies\n  and other stuff we don't care about. We ignore them, anyone can import them.\n- `common` are packages that contain shared code between services.\n  Common packages can import from each other, and services can import from common packages.\n- `service` are packages containing code for a component or microservice.\n  They can import from common packages and from external packages,\n  and cannot import code from other services.\n- `utility` are packages that contain utility scripts that should only be run locally.\n  They can import from wherever they want, and no one can import them.\n\nTo configure the tool, create a `dep-check.yaml` file in the root of your Go project,\nand fill its contents like this:\n\n```yaml\nmodule_name: github.com/moveaxlab/dep-check  # the module name of your project\nfolders:\n  external:\n    - external/*\n  common:\n    - common/src/*\n    - models/*\n  utility:\n    - scripts\n    - common/scripts\n  service:\n    - service/*\n```\n\nThe `folders` configuration specifies which folders fall in which category.\nAll folders are specified from the root of your Go project.\nYou can use the `*` symbols as a wildcard: this instructs `dep-check` to treat\neach folder under the specified path as a separate package.\n\nAn example is worth a thousand words.\nGiven the above configuration and the following directory structure:\n\n```\ncommon/\n  scripts/\n    script_1/\n    script_2/\n  src/\n    config/\n    postgres/\n    kafka/\n      consumer/\n      producer/\nexternal/\n  dep_1/\n  dep_2/\nmodels/\n  auth/\n  common/\n  order/\n  product/\nscripts/\n  script_3/\n  script_4/\nservice/\n  service_1/\n  service_2/\n  service_3/\nother_package/\n```\n\n`dep-check` will identify these packages:\n\n- external packages:\n  - `external`\n  - `other_package`\n- utility packages:\n  - `common/scripts`\n  - `scripts`\n- common packages:\n  - `common/src/config`\n  - `common/src/postgres`\n  - `common/src/kafka`\n  - `models/auth`\n  - `models/common`\n  - `models/order`\n  - `models/product`\n- service packages:\n  - `service/service_1`\n  - `service/service_2`\n  - `service/service_3`\n\nAll packages that are not matched by an explicit rule will fall under the external category.\nYou can add the `'*'` catch all to the service category to treat all other packages as services.\n\nIf the root of your repo is not the same as the root of your Go project,\nyou can add the `root_dir` configuration option to specify the path from the root of the repo\nto the root of your Go project.\n\n\u003e You only need this to run tests selectively when using git.\n\nYou can now run `dep-check` from the root of your Go project.\n\n## Validating project structure\n\n```bash\ndep-check validate\n```\n\n## Running tests selectively\n\nGet a list of changed files and feed it to `dep-check`:\n\n```bash\nreadarray -t PACKAGES \u003c \u003c(git diff --name-only \"${TARGET_BRANCH}...${CURRENT_BRANCH}\" | dep-check changed-packages)\n```\n\nYou can also run tests on staged files:\n\n```bash\nreadarray -t PACKAGES \u003c \u003c(git diff --staged --name-only | dep-check changed-packages)\n```\n\nThen, iterate over the changed packages and run your tests:\n\n```bash\nfor PACKAGE in \"${PACKAGES[@]}\"\ndo\n  go test  \"$PACKAGE\"\ndone\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoveaxlab%2Fdep-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoveaxlab%2Fdep-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoveaxlab%2Fdep-check/lists"}