{"id":13713266,"url":"https://github.com/masibw/goone","last_synced_at":"2026-01-28T23:05:59.036Z","repository":{"id":46732446,"uuid":"291634060","full_name":"masibw/goone","owner":"masibw","description":"goone finds N+1 query in go ","archived":false,"fork":false,"pushed_at":"2022-07-31T02:04:45.000Z","size":109,"stargazers_count":52,"open_issues_count":2,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-06T23:35:34.286Z","etag":null,"topics":["go","loop","performance","sql"],"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/masibw.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}},"created_at":"2020-08-31T06:31:30.000Z","updated_at":"2024-10-05T16:11:00.000Z","dependencies_parsed_at":"2022-09-26T18:31:36.943Z","dependency_job_id":null,"html_url":"https://github.com/masibw/goone","commit_stats":null,"previous_names":["masibw/go_one"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/masibw/goone","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masibw%2Fgoone","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masibw%2Fgoone/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masibw%2Fgoone/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masibw%2Fgoone/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/masibw","download_url":"https://codeload.github.com/masibw/goone/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/masibw%2Fgoone/sbom","scorecard":{"id":622774,"data":{"date":"2025-08-11","repo":{"name":"github.com/masibw/goone","commit":"99922420b99c05434ae643dfe5c8d8b45b146b19"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.4,"checks":[{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 1/18 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/lint.yml:1","Warn: no topLevel permission defined: .github/workflows/release.yml:1","Warn: no topLevel permission defined: .github/workflows/test.yml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/lint.yml:11: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/lint.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/lint.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/lint.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:33: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:35: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/release.yml:40: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/release.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/release.yml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/release.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/test.yml/master?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/test.yml/master?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/masibw/goone/test.yml/master?enable=pin","Info:   0 out of   6 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   5 third-party GitHubAction dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v1.4.1 not signed: https://api.github.com/repos/masibw/goone/releases/73269853","Warn: release artifact v1.4.0 not signed: https://api.github.com/repos/masibw/goone/releases/36392331","Warn: release artifact v1.1.0 not signed: https://api.github.com/repos/masibw/goone/releases/34155959","Warn: release artifact v1.4.1 does not have provenance: https://api.github.com/repos/masibw/goone/releases/73269853","Warn: release artifact v1.4.0 does not have provenance: https://api.github.com/repos/masibw/goone/releases/36392331","Warn: release artifact v1.1.0 does not have provenance: https://api.github.com/repos/masibw/goone/releases/34155959"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 30 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-21T05:33:14.316Z","repository_id":46732446,"created_at":"2025-08-21T05:33:14.316Z","updated_at":"2025-08-21T05:33:14.316Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28854511,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"ssl_error","status_checked_at":"2026-01-28T22:56:00.861Z","response_time":57,"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":["go","loop","performance","sql"],"created_at":"2024-08-02T23:01:31.162Z","updated_at":"2026-01-28T23:05:59.016Z","avatar_url":"https://github.com/masibw.png","language":"Go","funding_links":[],"categories":["Repositories"],"sub_categories":[],"readme":"![test_and_lint](https://github.com/masibw/go_one/workflows/test_and_lint/badge.svg)\n\n# goone\ngoone finds N+1(strictly speaking call SQL in a for loop) query in go \n\n## Example\n```go\npackage main\n\nimport (\n\t\"database/sql\"\n\t\"fmt\"\n\t\"log\"\n\n\t_ \"github.com/go-sql-driver/mysql\"\n)\n\n\ntype Person struct {\n\tName string\n\tJobID int\n}\n\ntype Job struct {\n\tJobID int\n\tName string\n}\n\nfunc main(){\n\n\tcnn, _ := sql.Open(\"mysql\", \"user:password@tcp(host:port)/dbname\")\n\n\trows, _ := cnn.Query(\"SELECT name, job_id FROM persons\")\n\n\tdefer rows.Close()\n\n\tfor rows.Next() {\n\t\tvar person Person\n\t\tif err := rows.Scan(\u0026person.Name,\u0026person.JobID); err != nil {\n\t\t\tlog.Fatal(err)\n\t\t}\n\n\t\tvar job Job\n\n        // This is N+1 query\n\t\tif err := cnn.QueryRow(\"SELECT job_id, name FROM Jobs WHERE job_id = ?\",person.JobID).Scan(\u0026job.JobID,\u0026job.Name); err != nil { \n\t\t\tlog.Fatal(err)\n\t\t}\n\t\tfmt.Println(person.Name,job.Name)\n\t}\n\n}\n```\n\n## output\n```\n./hoge.go:38:13: this query is called in a loop\n```\n\n# Install\n```\ngo get github.com/masibw/goone/cmd/goone\n```\n\n# Usage\n\n## bash\n```\ngo vet -vettool=`which goone` ./...\n```\n\n## fish\n```\ngo vet -vettool=(which goone) ./...\n```\n\n\n## CI\n### Github Actions\n```\n- name: install goone\n    run: go get -u github.com/masibw/goone/cmd/goone\n- name: run goone\n    run: go vet -vettool=`which goone` -goone.configPath=\"$PWD/goone.yml\" ./...\n```\n\n# Library Support\n- sql\n- sqlx\n- gorp\n- gorm\n\nYou can add types to detect sql query.\n\n# Config\nYou can add any types that you want to detect as sql query.\nYou can also detect the case where an interface is in between by writing below. example [project](https://github.com/masibw/go_todo)\n```yaml:goone.yml\npackage:\n  - pkgName: 'github.com/masibw/go_todo/cmd/go_todo/infrastructure/api/handler'\n    typeNames:\n      - typeName: '*todoHandler'\n```\ngoone searches for `goone.yml` in directories up to the root from the file directory which analyzing currently. (not the working directory(command executed))\n\nYou can use the `-goone.configPath` flag at runtime to indicate config by an absolute path.\n\n## Example\n\nIf goone.yml exists in the directory where the command was executed\n```\ngo vet -vettool=`which goone` -goone.configPath=\"$PWD/goone.yml\" ./...\n```\n\n\n\n# Contribute\nYou're welcome to build an Issue or create a PR and be proactive!\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasibw%2Fgoone","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmasibw%2Fgoone","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmasibw%2Fgoone/lists"}