Serving gziped connect via HTTP in golang

The builtin HTTP server in the golang standard library does not serve gziped content. However you can relatively easily add a wrapper function to compress data on the fly. The best tool to do this appears to be go.httpgzip. A basic example of its usage might look like this:

import (

func main() {
  http.Handle("/", httpgzip.NewHandler(http.FileServer(http.Dir("."))))
  err := http.ListenAndServe(":80", nil)
  if err != nil {
    panic("Error: " + err.Error())