{"id":38787380,"url":"https://github.com/cloverrose/pkgdep","last_synced_at":"2026-04-03T04:01:50.553Z","repository":{"id":234156363,"uuid":"787209223","full_name":"cloverrose/pkgdep","owner":"cloverrose","description":"pkgdep checks if package dependency follows rule","archived":false,"fork":false,"pushed_at":"2026-02-19T07:43:26.000Z","size":107,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-02-19T13:46:28.155Z","etag":null,"topics":["dependency","dependency-analysis","golang","modular-monolith","static-analysis"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":false,"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/cloverrose.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-04-16T05:10:45.000Z","updated_at":"2026-02-19T07:22:09.000Z","dependencies_parsed_at":"2024-04-18T11:08:29.489Z","dependency_job_id":"437fa1e5-b78b-49c6-b134-e6136ab9f058","html_url":"https://github.com/cloverrose/pkgdep","commit_stats":null,"previous_names":["cloverrose/pkgdep"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/cloverrose/pkgdep","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloverrose%2Fpkgdep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloverrose%2Fpkgdep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloverrose%2Fpkgdep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloverrose%2Fpkgdep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloverrose","download_url":"https://codeload.github.com/cloverrose/pkgdep/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloverrose%2Fpkgdep/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31333229,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T03:20:36.090Z","status":"ssl_error","status_checked_at":"2026-04-03T03:20:35.133Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["dependency","dependency-analysis","golang","modular-monolith","static-analysis"],"created_at":"2026-01-17T12:35:14.823Z","updated_at":"2026-04-03T04:01:50.531Z","avatar_url":"https://github.com/cloverrose.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pkgdep\n\n`pkgdep` checks if package dependency follows rule.\n\n## Options\n\n- `config` (required)\n  - Path to the configuration file (e.g. `.pkgdep.yaml`)\n  - Supported file extensions: `.yaml`, `.yml`\n- `log.level` (optional)\n  - Controls logging verbosity\n  - Valid values: `DEBUG`, `INFO`, `WARN`, `ERROR`\n  - Default: `INFO`\n- `log.file` (optional)\n  - Path to write log output\n  - If unspecified, logs to stdout\n  - Note: When using with golangci-lint, a log file must be specified since stdout is captured\n- `log.format` (optional)\n  - Controls log output format\n  - Valid values: `json`, `text`\n  - Default: `json`\n- `inspector.file` (optional, experimental)\n  - Path to write inspector output\n  - If unspecified, inspector output is not saved\n  - Inspector output contains information about which dependency rules were used\n  - **Warning**: The inspector feature is experimental and may change or be removed in future versions without notice.\n\nYou can configure via commandline option or golangci setting.\n\n## Install\n\n```shell\n$ go install github.com/cloverrose/pkgdep/cmd/pkgdep@latest\n```\n\n### Or Build from source\n\n```shell\n$ make build/pkgdep\n```\n\n### Or Install via aqua\n\nhttps://aquaproj.github.io/\n\n## Usage\n\n### 1. Create .pkgdep.yaml in your repository\n\nSee [.pkgdep.yaml](./.pkgdep.yaml) as example.\n\nWe can use regexp.\n\n**Detailed Information**\n\n`dependencies` is unmarshalled into an ordered map. Package dependencies are validated in order, starting from the first entry.\n\n**globalData**\n\npkgdep v0.8.0+ supports `globalData` field in `.pkgdep.yaml`.\nThis is helpful when your `.pkgdep.yam` becomes complex and has repetetive patterns.\n\nFor example, `application` layer can depend on `domain` and `infra` layer, and `domain` layer can depend on `infra` layer. We can define this relationship without `globalData`.\n\n```yaml\ndependencies:\n  .+/modules/(?P\u003cmoduleName\u003e[^/]+)/layers/application$:\n    - .+/modules/{{ .moduleName }}/layers/(domain|infra)\n  .+/modules/(?P\u003cmoduleName\u003e[^/]+)/layers/domain$:\n    - .+/modules/{{ .moduleName }}/layers/(infra)\n```\n\nWith `globalData` we can define like this.\n\n```yaml\nglobalData:\n  application: (domain|infra)\n  domain: (infra)\ndependencies:\n  .+/modules/(?P\u003cmoduleName\u003e[^/]+)/layers/(?P\u003clayerName\u003e[^/]+)$:\n    - .+/modules/{{ .moduleName }}/layers/{{ index .globalData  .layerName }}\n```\n\nWhen regexp pattern name is `globalData` (e.g. `(?P\u003cglobalData\u003efoo)`), pattern name takes priority over globalData field.\n\n**block list mode**\n\npkgdep v0.9.0+ supports `mode` field in `.pkgdep.yaml`.\n\nAvailable modes are `allow_list` and `block_list`. Default mode is `allow_list`.\n\nSee [.pkgdep_blocklist.yaml](.pkgdep_blocklist.yaml) as example.\n\nThis is helpful in case\n1) you want to introduce pkgdep but describing all allowed dependencies is difficult.\n2) your `.pkgdep.yaml` becomes complex.\n\n\nFor case 1, you can block specific dependencies that you really want to avoid.\n\nFor case 2, you can have both `.pkgdep.yaml` (for allow list) and `.pkgdep_blocklist.yaml`.\nWhile `.pkgdep.yaml` unintentionally allows some dependencies that you really want to avoid, you can detect that with `.pkgdep_blocklist.yaml`.\n\n### 2. Run\n\n#### A. Use as go vet tool\n\nconfig file path should be absolute.\n\n```shell\n$ go vet -vettool=`which pkgdep` -pkgdep.config=$(PWD)/.pkgdep.yaml ./...\n```\n\n#### B. Use as golangci-lint custom plugin\n\nhttps://golangci-lint.run/plugins/module-plugins/\n\nHere are reference settings\n\n`.custom-gcl.yml`\n\n```yaml\nversion: v2.3.1\nname: custom-golangci-lint\ndestination: bin\nplugins:\n  - module: 'github.com/cloverrose/pkgdep'\n    import: 'github.com/cloverrose/pkgdep'\n    version: v0.9.1\n```\n\n`.golangci.yml`\n\nconfig file path can be relative.\n\n```yaml\nlinters-settings:\n  custom:\n    pkgdep:\n      type: \"module\"\n      description: pkgdep validates if package dependency follows rule.\n      settings:\n        config: \"./.pkgdep.yaml\"\n        log:\n          level: \"INFO\"\n          file: \"./log.txt\"\n          format: \"json\"\n        inspector:\n          file: \"./used_rules.csv\"\n```\n\n# Other documents\n\n## pkgdep-tidy\n\n`pkgdep-tidy` is a command-line tool that helps clean up and optimize your `.pkgdep.yaml` configuration by:\n\n- Removing unused dependency rules\n- Cleaning up empty configuration keys\n- Maintaining clean, consistent formatting\n\nFor detailed usage instructions and examples, see the [pkgdep-tidy documentation](cmd/pkgdep-tidy/README.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloverrose%2Fpkgdep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloverrose%2Fpkgdep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloverrose%2Fpkgdep/lists"}