{"id":16220499,"url":"https://github.com/cristaloleg/sabotage","last_synced_at":"2025-03-19T11:30:59.076Z","repository":{"id":70453115,"uuid":"170588536","full_name":"cristaloleg/sabotage","owner":"cristaloleg","description":"Collection of dirty hacks in Go","archived":false,"fork":false,"pushed_at":"2023-03-18T09:15:44.000Z","size":52,"stargazers_count":67,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-15T01:44:57.626Z","etag":null,"topics":["golang","monkey-patching","unsafe"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cristaloleg.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":"2019-02-13T22:22:00.000Z","updated_at":"2024-08-03T23:42:50.000Z","dependencies_parsed_at":"2024-06-20T16:40:23.718Z","dependency_job_id":null,"html_url":"https://github.com/cristaloleg/sabotage","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristaloleg%2Fsabotage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristaloleg%2Fsabotage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristaloleg%2Fsabotage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristaloleg%2Fsabotage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristaloleg","download_url":"https://codeload.github.com/cristaloleg/sabotage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243985926,"owners_count":20379231,"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":["golang","monkey-patching","unsafe"],"created_at":"2024-10-10T11:58:52.277Z","updated_at":"2025-03-19T11:30:58.811Z","avatar_url":"https://github.com/cristaloleg.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SABOTAGE\n\n[![Build Status](https://travis-ci.org/cristaloleg/sabotage.svg)](https://travis-ci.org/cristaloleg/sabotage)\n[![GoDoc](https://godoc.org/github.com/cristaloleg/sabotage?status.svg)](https://godoc.org/github.com/cristaloleg/sabotage)\n[![Go Report](https://goreportcard.com/badge/github.com/cristaloleg/sabotage)](https://goreportcard.com/report/github.com/cristaloleg/sabotage)\n\nCollection of dirty hacks in Go.\n\n1. Repeat `sync.Once` once more.\n2. Check if `sync.Mutex`/`sync.RWMutex` is locked.\n3. `[]byte \u003c-\u003e string` conversion without additional allocation.\n\n![logo](https://raw.githubusercontent.com/cristaloleg/sabotage/master/sabotage.jpg)\n\n    Cause what you see, you might not get\n    And we can bet, so don't you get souped yet\n    Scheming on a thing, that's a mirage\n    I'm trying to tell you now, it's sabotage\n\n    Whhhhhyyyyyy??????\n\n    (c) Beastie Boys - Sabotage\n\n## Examples\n\n1. You can repeat `sync.Once` as much as you want:\n\n```go\nvar once sync.Once\n\nonce.Do(myFunc)\n\nsabotage.ResetSyncOnce(\u0026once) \n```\n\nor check if it was invoked earlier:\n\n```go\nif sabotage.IsOnceDone(\u0026once) {\n    println(\"well-well-well\")\n}\n```\n\n2. You can unlock any mutex from anywhere:\n\n```go\nvar mu sync.Mutex\n\n// let's yolo begins\nsabotage.UnlockMutex(\u0026mu)\n```\n\nor check if it's locked:\n\n```go\nif sabotage.IsMutexLocked(\u0026mu) {\n    for {\n        // let's wait a bit\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristaloleg%2Fsabotage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristaloleg%2Fsabotage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristaloleg%2Fsabotage/lists"}