Skip to content

Instantly share code, notes, and snippets.

@krak3n
Created September 3, 2015 10:19
Show Gist options
  • Save krak3n/06eb8894e93167a8e782 to your computer and use it in GitHub Desktop.
Save krak3n/06eb8894e93167a8e782 to your computer and use it in GitHub Desktop.
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 {
t, m, e := conn.ReadMessage()
if e != nil {
fmt.Println("Error")
conn.Close()
break ReadLoop
}
fmt.Println(t, string(m[:]), e)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment