Skip to content

Instantly share code, notes, and snippets.

@rochacon
Created August 31, 2015 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rochacon/188b0929ab42a87721f0 to your computer and use it in GitHub Desktop.
Save rochacon/188b0929ab42a87721f0 to your computer and use it in GitHub Desktop.
Simple Go app to print an UUID per instance. Useful to debug load balancers
package main
import (
"code.google.com/p/go-uuid/uuid"
"net/http"
)
var (
id []byte = []byte(uuid.New() + "\n")
)
func main(){
http.HandleFunc("/", getId)
println("Listening on 0.0.0.0:8000")
http.ListenAndServe(":8000", nil)
}
func getId(w http.ResponseWriter, r *http.Request) {
w.Write(id)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment