{"id":47762113,"url":"https://github.com/da440dil/go-locker","last_synced_at":"2026-04-03T05:41:00.747Z","repository":{"id":57554936,"uuid":"174515828","full_name":"da440dil/go-locker","owner":"da440dil","description":"Distributed locking on Go","archived":false,"fork":false,"pushed_at":"2021-11-09T06:35:00.000Z","size":87,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-18T14:48:18.475Z","etag":null,"topics":["distributed","distributed-lock","distributed-locking","go","golang","lock","locking","locks","redis"],"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/da440dil.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-08T10:19:04.000Z","updated_at":"2022-10-25T01:00:16.000Z","dependencies_parsed_at":"2022-09-26T18:51:30.208Z","dependency_job_id":null,"html_url":"https://github.com/da440dil/go-locker","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"purl":"pkg:github/da440dil/go-locker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/da440dil%2Fgo-locker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/da440dil%2Fgo-locker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/da440dil%2Fgo-locker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/da440dil%2Fgo-locker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/da440dil","download_url":"https://codeload.github.com/da440dil/go-locker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/da440dil%2Fgo-locker/sbom","scorecard":{"id":316042,"data":{"date":"2025-08-11","repo":{"name":"github.com/da440dil/go-locker","commit":"0e934fe7a9046cd7a44ae28e746ad6e34a2c41aa"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"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":"Code-Review","score":0,"reason":"Found 0/30 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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"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":-1,"reason":"no workflows found","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":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"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":"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":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"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":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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"}}]},"last_synced_at":"2025-08-18T00:12:13.170Z","repository_id":57554936,"created_at":"2025-08-18T00:12:13.170Z","updated_at":"2025-08-18T00:12:13.170Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31337045,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-03T04:42:29.251Z","status":"ssl_error","status_checked_at":"2026-04-03T04:42:12.667Z","response_time":107,"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":["distributed","distributed-lock","distributed-locking","go","golang","lock","locking","locks","redis"],"created_at":"2026-04-03T05:40:56.709Z","updated_at":"2026-04-03T05:41:00.740Z","avatar_url":"https://github.com/da440dil.png","language":"Go","readme":"# go-locker\n\n[![Build Status](https://travis-ci.com/da440dil/go-locker.svg?branch=master)](https://travis-ci.com/da440dil/go-locker)\n[![Coverage Status](https://coveralls.io/repos/github/da440dil/go-locker/badge.svg?branch=master)](https://coveralls.io/github/da440dil/go-locker?branch=master)\n[![Go Reference](https://pkg.go.dev/badge/github.com/da440dil/go-locker.svg)](https://pkg.go.dev/github.com/da440dil/go-locker)\n[![Go Report Card](https://goreportcard.com/badge/github.com/da440dil/go-locker)](https://goreportcard.com/report/github.com/da440dil/go-locker)\n\nDistributed locking using [Redis](https://redis.io/).\n\n[Example](./examples/main.go) usage:\n\n```go\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/da440dil/go-locker\"\n\t\"github.com/go-redis/redis/v8\"\n)\n\nfunc main() {\n\tclient := redis.NewClient(\u0026redis.Options{})\n\tdefer client.Close()\n\n\t// Create locker.\n\tlkr := locker.NewLocker(client)\n\tctx := context.Background()\n\tkey := \"key\"\n\terr := client.Del(ctx, key).Err()\n\trequireNoError(err)\n\n\tlock := func() {\n\t\t// Try to apply lock.\n\t\tlr, err := lkr.Lock(ctx, key, time.Second)\n\t\trequireNoError(err)\n\t\tif !lr.OK() {\n\t\t\tfmt.Printf(\"Failed to apply lock, retry after %v\\n\", lr.TTL())\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"Lock applied\")\n\n\t\t// Try to release lock.\n\t\tdefer func() {\n\t\t\tok, err := lr.Unlock(ctx)\n\t\t\trequireNoError(err)\n\t\t\tif ok {\n\t\t\t\tfmt.Println(\"Lock released\")\n\t\t\t} else {\n\t\t\t\tfmt.Println(\"Failed to release lock\")\n\t\t\t}\n\t\t}()\n\n\t\ttime.Sleep(time.Millisecond * 100) // some code here\n\n\t\t// Optionally try to extend lock.\n\t\tr, err := lr.Lock.Lock(ctx, time.Second)\n\t\trequireNoError(err)\n\t\tif !r.OK() {\n\t\t\tfmt.Printf(\"Failed to extend lock, retry after %v\\n\", lr.TTL())\n\t\t\treturn\n\t\t}\n\t\tfmt.Println(\"Lock extended\")\n\t}\n\n\tvar wg sync.WaitGroup\n\twg.Add(2)\n\tfor i := 0; i \u003c 2; i++ {\n\t\tgo func() {\n\t\t\tdefer wg.Done()\n\t\t\tlock()\n\t\t}()\n\t}\n\twg.Wait()\n\t// Output:\n\t// Lock applied\n\t// Failed to apply lock, retry after 999ms\n\t// Lock extended\n\t// Lock released\n}\n\nfunc requireNoError(err error) {\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fda440dil%2Fgo-locker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fda440dil%2Fgo-locker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fda440dil%2Fgo-locker/lists"}