Skip to content

Instantly share code, notes, and snippets.

@fukamachi
Created October 15, 2014 22:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fukamachi/4c0dfb99453a33e2ace5 to your computer and use it in GitHub Desktop.
Save fukamachi/4c0dfb99453a33e2ace5 to your computer and use it in GitHub Desktop.
Go Hello World server
package main
import (
"fmt"
"log"
"net/http"
)
func hello(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World")
}
func main() {
http.HandleFunc("/", hello)
if err := http.ListenAndServe(":5000", nil); err != nil {
log.Fatal("ListenAndServe: ", err)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment