8000 GitHub - cristaloleg/sabotage: Collection of dirty hacks in Go
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

cristaloleg/sabotage

Repository files navigation

SABOTAGE

Build Status GoDoc Go Report

Collection of dirty hacks in Go.

  1. Repeat sync.Once once more.
  2. Check if sync.Mutex/sync.RWMutex is locked.
  3. []byte <-> string conversion without additional allocation.

logo

Cause what you see, you might not get
And we can bet, so don't you get souped yet
Scheming on a thing, that's a mirage
I'm trying to tell you now, it's sabotage

Whhhhhyyyyyy??????

(c) Beastie Boys - Sabotage

Examples

  1. You can repeat sync.Once as much as you want:
var once sync.Once

once.Do(myFunc)

sabotage.ResetSyncOnce(&once) 

or check if it was invoked earlier:

if sabotage.IsOnceDone(&once) {
    println("well-well-well")
}
  1. You can unlock any mutex from anywhere:
var mu sync.Mutex

// let's yolo begins
sabotage.UnlockMutex(&mu)

or check if it's locked:

if sabotage.IsMutexLocked(&mu) {
    for {
        // let's wait a bit
    }
}

About

Collection of dirty hacks in Go

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0