{"id":15048201,"url":"https://github.com/github/depstubber","last_synced_at":"2025-10-19T23:30:27.350Z","repository":{"id":45954986,"uuid":"254141159","full_name":"github/depstubber","owner":"github","description":"Depstubber generates type-correct stubs for Go dependencies, for use in testing","archived":false,"fork":false,"pushed_at":"2023-11-02T10:56:53.000Z","size":20966,"stargazers_count":16,"open_issues_count":2,"forks_count":8,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-01-30T07:42:40.585Z","etag":null,"topics":["keep"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/github.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-08T16:24:39.000Z","updated_at":"2024-12-26T05:40:59.000Z","dependencies_parsed_at":"2024-06-18T22:57:30.367Z","dependency_job_id":null,"html_url":"https://github.com/github/depstubber","commit_stats":{"total_commits":16,"total_committers":6,"mean_commits":"2.6666666666666665","dds":0.6875,"last_synced_commit":"87e272f60ed7abb9ad39ad213e507677a9cf3232"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fdepstubber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fdepstubber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fdepstubber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/github%2Fdepstubber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/github","download_url":"https://codeload.github.com/github/depstubber/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237224904,"owners_count":19275107,"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":["keep"],"created_at":"2024-09-24T21:09:06.899Z","updated_at":"2025-10-19T23:30:27.338Z","avatar_url":"https://github.com/github.png","language":"Go","readme":"# depstubber\n\n![CI](https://github.com/github/depstubber/workflows/CI/badge.svg)\n\nThis is a tool that generates type-correct stubs for dependencies, for use in\ntesting. It is particularly useful for testing static analysis applications,\nwhere including library source code may be undesirable. It was written and is currently\nused for testing [CodeQL Go](https://github.com/github/codeql-go).\n\nThe general usage pattern if vendoring is desired will look something like:\n\n```sh\nPATH=\"$PATH:$GOPATH/bin\"\nGO111MODULES=off go get github.com/github/depstubber\nGO111MODULES=off go install github.com/github/depstubber # Only needed for Go 1.18 and above\ngo mod tidy # required to generate go.sum\n# generate a vendor/module.txt for the go 1.24 vendor consistency check\ndepstubber -write_module_txt\n# Create stubs of Type1, Type2, SomeFunc, and SomeVariable. They are separated by a space\n# because values must be treated differently from types in the implementation of depstubber.\ndepstubber -vendor github.com/my/package Type1,Type2 SomeFunc,SomeVariable\n```\n\nThe last line can be executed using Go's built in `generate` subcommand, by\nadding a comment to any relevant Go file that looks like this:\n\n```go\n//go:generate depstubber -vendor github.com/my/package Type1,Type2 SomeFunc,SomeVariable\n```\n\nThen, run `go generate \u003cpackage\u003e`, where `\u003cpackage\u003e` is the package containing\nthe file the comment was added to. This will automatically run the depstubber\ncommand.\n\nLimitations:\n\n- It is limited to a single package at a time.\n- There is no way to automatically stub all exports.\n- It does not generate memory-compatible types, as unexported types are\n  skipped.\n- There is no way to automatically detect exports used in a program.\n- There is no way to specify specific methods on a type; all methods are\n  automatically stubbed.\n- It cannot currently distinguish between type aliases. This is a\n  limitation of the `reflect` package.\n- It makes new method declarations for promoted methods. This is a\n   limitation of the `reflect` package.\n\nPlease feel free to submit a [pull\nrequest](https://github.com/github/depstubber/pulls) for any of the above, or\nwith any other improvements. See [CONTRIBUTING.md](CONTRIBUTING.md) for more\ninformation.\n\nFor information about what improvements may be in progress, see\n[issues](https://github.com/github/depstubber/issues).\n\nTo build, simply run `go build` with Go 1.14 or higher.\n\nThis project contains a significant amount of code copied from the [GoMock\nproject](https://github.com/golang/mock), as well as from the [Go standard\nlibrary](https://github.com/golang/go). The mock code has been adapted to\ngenerate stub versions of requested exported fields instead of generating a mock\nimplementation of an interface. The licenses for both these codebases can be\nfound in the `NOTICE` file.\n\nIt is licensed under Apache-2.0. For more information, see the `LICENSE` file.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fdepstubber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgithub%2Fdepstubber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgithub%2Fdepstubber/lists"}