Skip to content

Instantly share code, notes, and snippets.

View krak3n's full-sized avatar
🏳️‍🌈

Chris Reeves krak3n

🏳️‍🌈
View GitHub Profile
@krak3n
krak3n / looplabel.go
Created September 3, 2015 10:19
Golang Loop Labels
func (p *PerceptorService) Run() {
for {
conn, _, err := d.Dial(host, headers)
if err != nil {
fmt.Printf("WS Connection Failure: %s", err)
time.Sleep(time.Second)
continue
}
ReadLoop:
for {
@krak3n
krak3n / main.go
Last active September 12, 2017 10:35
Testing using Golden files in Go
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"io"
"os"
)
package main
import (
"bufio"
"bytes"
"io/ioutil"
"path/filepath"
"testing"
)
package main
import (
"bufio"
"bytes"
"flag"
"io/ioutil"
"path/filepath"
"testing"
)
package main
import (
"bufio"
"bytes"
"flag"
"io/ioutil"
"path/filepath"
"testing"
)
type TestSetter struct {
cmd *redis.StatusCmd
}
func (t *TestSetter) Set(k string, v interface{}, d time.Duration) *redis.StatusCmd {
return t.cmd
}
// Unit - make it fail
func Test_setUser(t *testing.T) {