Skip to content

Instantly share code, notes, and snippets.

@kanuku
Created February 8, 2015 20:10
Show Gist options
  • Save kanuku/34458e4d44f164cec00d to your computer and use it in GitHub Desktop.
Save kanuku/34458e4d44f164cec00d to your computer and use it in GitHub Desktop.
./main.go:22: INDEX_HTML declared and not used
package main
import (
"fmt"
"io/ioutil"
"net/http"
)
var INDEX_HTML []byte
func main() {
fmt.Println("starting server on http://localhost:8080/")
http.HandleFunc("/", IndexHandler)
http.ListenAndServe(":8080", nil)
}
func IndexHandler(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(INDEX_HTML))
}
func init() {
INDEX_HTML, _ := ioutil.ReadFile("./tmpl/index.html")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment