{"id":15663724,"url":"https://github.com/sivchari/containedctx","last_synced_at":"2025-04-04T19:11:32.129Z","repository":{"id":44764777,"uuid":"432771208","full_name":"sivchari/containedctx","owner":"sivchari","description":"containedctx is a linter that detects struct contained context.Context field","archived":false,"fork":false,"pushed_at":"2024-12-09T12:15:19.000Z","size":16,"stargazers_count":19,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-28T18:14:06.458Z","etag":null,"topics":["go","golang","golangci-lint","linter","static-analysis"],"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/sivchari.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}},"created_at":"2021-11-28T16:55:47.000Z","updated_at":"2024-12-09T12:15:23.000Z","dependencies_parsed_at":"2024-06-18T18:19:39.741Z","dependency_job_id":"7dd76c7c-af5b-4ebd-8a37-de7f099aba49","html_url":"https://github.com/sivchari/containedctx","commit_stats":{"total_commits":8,"total_committers":3,"mean_commits":"2.6666666666666665","dds":0.25,"last_synced_commit":"70e6ad2141f5356f171e6ce155b64e72ab7febf5"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivchari%2Fcontainedctx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivchari%2Fcontainedctx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivchari%2Fcontainedctx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sivchari%2Fcontainedctx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sivchari","download_url":"https://codeload.github.com/sivchari/containedctx/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234921,"owners_count":20905854,"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":["go","golang","golangci-lint","linter","static-analysis"],"created_at":"2024-10-03T13:39:38.534Z","updated_at":"2025-04-04T19:11:32.124Z","avatar_url":"https://github.com/sivchari.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# containedctx\n\n[![test_and_lint](https://github.com/sivchari/containedctx/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/sivchari/containedctx/actions/workflows/ci.yml)\n\ncontainedctx is a linter that detects struct contained context.Context field. \nThis is discouraged technique in favour of passing context as first argument of method or function. \nFor rationale please read [Contexts and structs](https://go.dev/blog/context-and-structs) the Go blog post.\n\n## Instruction\n\n```sh\ngo install github.com/sivchari/containedctx/cmd/containedctx@latest\n```\n\n## Usage\n\n```go\npackage main\n\nimport \"context\"\n\ntype ok struct {\n\ti int\n\ts string\n}\n\ntype ng struct {\n\tctx context.Context\n}\n\ntype empty struct{}\n```\n\n```console\ngo vet -vettool=(which containedctx) ./...\n\n# a\n./main.go:11:2: found a struct that contains a context.Context field\n```\n\n\n## CI\n\n### CircleCI\n\n```yaml\n- run:\n    name: install containedctx\n    command: go install github.com/sivchari/containedctx/cmd/containedctx\n\n- run:\n    name: run containedctx\n    command: go vet -vettool=`which containedctx` ./...\n```\n\n### GitHub Actions\n\n```yaml\n- name: install containedctx\n  run: go install github.com/sivchari/containedctx/cmd/containedctx\n\n- name: run containedctx\n  run: go vet -vettool=`which containedctx` ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivchari%2Fcontainedctx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsivchari%2Fcontainedctx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsivchari%2Fcontainedctx/lists"}