Skip to content

Instantly share code, notes, and snippets.

@mwerner
Last active December 30, 2015 20:29
Show Gist options
  • Save mwerner/7881370 to your computer and use it in GitHub Desktop.
Save mwerner/7881370 to your computer and use it in GitHub Desktop.
Hello Go
package main
import (
"fmt"
"log"
"net/http"
)
const listenAddr = "localhost:4000"
func main() {
http.HandleFunc("/", handler)
err := http.ListenAndServe(listenAddr, nil)
if err != nil {
log.Fatal(err)
}
}
func handler(w http.ResponseWriter, r *http.Request){
fmt.Fprint(w, "Hello, web")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment