{"id":42072520,"url":"https://github.com/gcpug/zagane","last_synced_at":"2026-01-26T09:05:55.211Z","repository":{"id":48190067,"uuid":"176246230","full_name":"gcpug/zagane","owner":"gcpug","description":"zagane is a static analysis tool which can find bugs in spanner's code","archived":false,"fork":false,"pushed_at":"2025-08-08T01:24:28.000Z","size":2281,"stargazers_count":95,"open_issues_count":12,"forks_count":16,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-08-13T16:58:26.414Z","etag":null,"topics":["golang","linter","spanner","staticanalysis"],"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/gcpug.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":"2019-03-18T09:23:10.000Z","updated_at":"2025-07-18T13:11:38.000Z","dependencies_parsed_at":"2025-06-06T02:25:33.839Z","dependency_job_id":"5b3cda3e-6f3d-4bad-ab62-db9f59267420","html_url":"https://github.com/gcpug/zagane","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/gcpug/zagane","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcpug%2Fzagane","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcpug%2Fzagane/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcpug%2Fzagane/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcpug%2Fzagane/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gcpug","download_url":"https://codeload.github.com/gcpug/zagane/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gcpug%2Fzagane/sbom","scorecard":{"id":420800,"data":{"date":"2025-08-11","repo":{"name":"github.com/gcpug/zagane","commit":"eb6a2e226b45797b140a0fc1dbc67576f8a4379e"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":5.2,"checks":[{"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":"Maintained","score":10,"reason":"22 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"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":"Code-Review","score":6,"reason":"Found 6/9 approved changesets -- score normalized to 6","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":"Pinned-Dependencies","score":2,"reason":"dependency not pinned by hash detected -- score normalized to 2","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/tagpr.yml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/gcpug/zagane/tagpr.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/tagpr.yml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/gcpug/zagane/tagpr.yml/main?enable=pin","Warn: goCommand not pinned by hash: .github/workflows/testandvet.yml:44","Info:   3 out of   4 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   1 third-party GitHubAction dependencies pinned","Info:   0 out of   1 goCommand 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":"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":"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: jobLevel 'contents' permission set to 'write': .github/workflows/tagpr.yml:10","Warn: no topLevel permission defined: .github/workflows/tagpr.yml:1","Warn: no topLevel permission defined: .github/workflows/testandvet.yml:1"],"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":"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":"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":"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":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"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":3,"reason":"branch protection is not maximal on development and all release branches","details":["Info: 'allow deletion' disabled on branch 'main'","Info: 'force pushes' disabled on branch 'main'","Info: 'branch protection settings apply to administrators' is required to merge on branch 'main'","Warn: could not determine whether codeowners review is allowed","Warn: no status checks found to merge onto branch 'main'","Warn: PRs are not required to make changes on branch 'main'; or we don't have data to detect it.If you think it might be the latter, make sure to run Scorecard with a PAT or use Repo Rules (that are always public) instead of Branch Protection settings"],"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":"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"}},{"name":"Vulnerabilities","score":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2023-2153 / GHSA-m425-mq94-257g / GHSA-qppj-fm5r-hxr3"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T01:08:47.000Z","repository_id":48190067,"created_at":"2025-08-19T01:08:47.000Z","updated_at":"2025-08-19T01:08:47.000Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28771632,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T08:38:24.014Z","status":"ssl_error","status_checked_at":"2026-01-26T08:38:22.080Z","response_time":59,"last_error":"SSL_read: 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":["golang","linter","spanner","staticanalysis"],"created_at":"2026-01-26T09:05:53.143Z","updated_at":"2026-01-26T09:05:55.194Z","avatar_url":"https://github.com/gcpug.png","language":"Go","readme":"# zagane\n\n[![GoDoc](https://pkg.go.dev/github.com/gcpug/zagane?status.svg)](https://pkg.go.dev/github.com/gcpug/zagane)\n\n`zagane` is a static analysis tool which can find bugs in spanner's code.\n`zagane` consists of several analyzers.\n\n* `unstopiter`: it finds iterators which did not stop.\n* `unclosetx`: it finds transactions which does not close\n* `wraperr`: it finds [(*spanner.Client).ReadWriteTransaction](https://pkg.go.dev/cloud.google.com/go/spanner#Client.ReadWriteTransaction) calls which returns wrapped errors\n\n## Install\n\nYou can get `zagane` by `go install` command.\n\n```bash\n$ go install github.com/gcpug/zagane@latest\n```\n\n## How to use\n\n`zagane` run with `go vet` as below.\n\n```bash\n$ go vet -vettool=$(which zagane) github.com/gcpug/spshovel/...\n# github.com/gcpug/spshovel/spanner\nspanner/spanner_service.go:29:29: iterator must be stop\n```\n\n## Analyzers\n\n### unstopiter\n\n`unstopiter` finds spanner.RowIterator which is not calling [Stop](https://pkg.go.dev/cloud.google.com/go/spanner#RowIterator.Stop) method or [Do](https://pkg.go.dev/cloud.google.com/go/spanner#RowIterator.Do) method such as below code.\n\n```go\niter := client.Single().Query(ctx, stmt)\nfor {\n\trow, err := iter.Next()\n\t// ...\n}\n```\n\nThis code must be fixed as below.\n\n```go\niter := client.Single().Query(ctx, stmt)\ndefer iter.Stop()\nfor {\n\trow, err := iter.Next()\n\t// ...\n}\n```\n\n### unclosetx\n\n`unclosetx` finds spanner.ReadOnlyTransaction which is not calling [Close](https://pkg.go.dev/cloud.google.com/go/spanner#ReadOnlyTransaction.Close) method such as below code.\n\n```go\ntx := client.ReadOnlyTransaction()\n// ...\n```\n\nThis code must be fixed as below.\n\n```go\ntx := client.ReadOnlyTransaction()\ndefer tx.Close()\n// ...\n```\n\nWhen a transaction is created by [`(*spanner.Client).Single`](https://pkg.go.dev/cloud.google.com/go/spanner#ReadOnlyTransaction), `unclosetx` ignore it.\n\n### wraperr\n\n`wraperr` finds ReadWriteTransaction calls which returns wrapped errors such as the below code.\n\n```go\nfunc f(ctx context.Context, client *spanner.Client) {\n\tclient.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error {\n\t\tstmt := spanner.Statement{SQL: `SELECT 1`}\n\t\t_, err := client.Single().Query(ctx, stmt).Next()\n\t\tif err != nil {\n\t\t\treturn errors.Wrap(err, \"wrapped\") // want \"must not be wrapped\"\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n\nThis code must be fixed as below.\n\n```go\nfunc f(ctx context.Context, client *spanner.Client) {\n\tclient.ReadWriteTransaction(ctx, func(ctx context.Context, txn *spanner.ReadWriteTransaction) error {\n\t\tstmt := spanner.Statement{SQL: `SELECT 1`}\n\t\t_, err := client.Single().Query(ctx, stmt).Next()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\treturn nil\n\t})\n}\n```\n\n## Ignore Checks\n\nAnalyzers ignore nodes which are annotated by [staticcheck's style comments](https://staticcheck.io/docs/#ignoring-problems) as belows.\nA ignore comment includes analyzer names and reason of ignoring checking.\nIf you specify `zagane` as analyzer name, all analyzers ignore corresponding code.\n\n```go\n//lint:ignore zagane reason\nvar n int\n\n//lint:ignore unstopiter reason\n_, _ = client.Single().Query(ctx, stmt).Next()\n```\n\n## Analyze with golang.org/x/tools/go/analysis\n\nYou can get analyzers of zagane from [zagane.Analyzers](https://pkg.go.dev/github.com/gcpug/zagane/zagane/#Analyzers).\nAnd you can use them with [unitchecker](https://golang.org/x/tools/go/analysis/unitchecker).\n\n## Why name is \"zagane\"?\n\n\"zagane\" (座金) means \"washer\" in Japanese.\nA washer works between a spanner and other parts.\n`zagane` also works between Cloud Spanner and your applications.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcpug%2Fzagane","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgcpug%2Fzagane","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgcpug%2Fzagane/lists"}