{"id":15935935,"url":"https://github.com/qawatake/notany","last_synced_at":"2025-06-15T09:08:50.663Z","repository":{"id":202848742,"uuid":"708034724","full_name":"qawatake/notany","owner":"qawatake","description":"Linter: notany limits possible types for arguments of any type.","archived":false,"fork":false,"pushed_at":"2023-11-09T11:58:56.000Z","size":87,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-03T19:36:17.098Z","etag":null,"topics":["go","golang","linter","staticanalysis"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/qawatake/notany","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/qawatake.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":"2023-10-21T10:24:40.000Z","updated_at":"2023-10-28T04:26:57.000Z","dependencies_parsed_at":"2023-11-09T12:58:05.305Z","dependency_job_id":"c201b378-5496-4978-9096-ece99ae55433","html_url":"https://github.com/qawatake/notany","commit_stats":{"total_commits":35,"total_committers":1,"mean_commits":35.0,"dds":0.0,"last_synced_commit":"b2f29f1d04590df83353a67a8fc59acd26d57ea6"},"previous_names":["qawatake/notany"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/qawatake/notany","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Fnotany","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Fnotany/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Fnotany/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Fnotany/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qawatake","download_url":"https://codeload.github.com/qawatake/notany/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qawatake%2Fnotany/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259949680,"owners_count":22936411,"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","linter","staticanalysis"],"created_at":"2024-10-07T04:02:58.421Z","updated_at":"2025-06-15T09:08:50.633Z","avatar_url":"https://github.com/qawatake.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# notany\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/qawatake/notany.svg)](https://pkg.go.dev/github.com/qawatake/notany)\n[![test](https://github.com/qawatake/notany/actions/workflows/test.yaml/badge.svg)](https://github.com/qawatake/notany/actions/workflows/test.yaml)\n[![codecov](https://codecov.io/gh/qawatake/notany/graph/badge.svg?token=mjocIOzSRm)](https://codecov.io/gh/qawatake/notany)\n\nLinter `notany` limits possible types for arguments of any type.\n\n```go\n// arg must be string, fmt.Stringer, or AllowedType.\nfunc FuncWithAnyTypeArg(arg any) {\n  // ...\n}\n\ntype AllowedType struct{}\n```\n\n```go\nfunc main() {\n  pkg.FuncWithAnyTypeArg(\"ok\")          // ok\n  pkg.FuncWithAnyTypeArg(time.Now())    // ok because time.Time implements fmt.Stringer\n  pkg.FuncWithAnyTypeArg(AllowedType{}) // ok\n  pkg.FuncWithAnyTypeArg(1.0)           // \u003c- float64 is not allowed\n  pkg.FuncWithAnyTypeArg(true)          // \u003c- bool is not allowed\n}\n```\n\n## How to use\n\nBuild your `notany` binary by writing `main.go` like below.\n\n```go\npackage main\n\nimport (\n  \"github.com/qawatake/notany\"\n  \"golang.org/x/tools/go/analysis/unitchecker\"\n)\n\nfunc main() {\n  unitchecker.Main(\n    notany.NewAnalyzer(\n      notany.Target{\n        PkgPath:  \"pkg/in/which/target/func/is/defined\",\n        FuncName: \"FuncWithAnyTypeArg\",\n        ArgPos:   1,\n        Allowed: []notany.Allowed{\n          {\n            PkgPath:  \"\",\n            TypeName: \"int\",\n          },\n          {\n            PkgPath:  \"fmt\",\n            TypeName: \"Stringer\",\n          },\n          {\n            PkgPath:  \"pkg/in/which/allowed/type/is/defined\",\n            TypeName: \"AllowedType\",\n          },\n        },\n      },\n    ),\n  )\n}\n```\n\nThen, run `go vet` with your `notany` binary.\n\n```sh\ngo vet -vettool=/path/to/your/notany ./...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqawatake%2Fnotany","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqawatake%2Fnotany","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqawatake%2Fnotany/lists"}