Browse Source

update for go release 60

raylu 14 năm trước cách đây
mục cha
commit
c4bdcf9ff6
2 tập tin đã thay đổi với 5 bổ sung4 xóa
  1. 3 3
      main.go
  2. 2 1
      mixpanel.go

+ 3 - 3
main.go

@@ -3,7 +3,7 @@ package main
 import (
 	"fmt"
 	"http"
-	"exp/template"
+	"template"
 	"os"
 	"json"
 	"strconv"
@@ -26,7 +26,7 @@ var templates *template.Set
 const debug = false
 
 func main() {
-	templates = template.SetMust(template.ParseTemplateFiles("templates/*.html"))
+	templates = template.SetMust(template.ParseTemplateGlob("templates/*.html"))
 	rand.Seed(time.Nanoseconds())
 	initDb()
 
@@ -47,7 +47,7 @@ func main() {
 func renderPage(w http.ResponseWriter, page string, data interface{}) {
 	if debug {
 		var err os.Error
-		templates, err = template.ParseTemplateFiles("templates/*.html")
+		templates, err = template.ParseTemplateGlob("templates/*.html")
 		if err != nil {
 			fmt.Fprintln(os.Stderr, err.String())
 			http.Error(w, err.String(), http.StatusInternalServerError)

+ 2 - 1
mixpanel.go

@@ -5,6 +5,7 @@ import (
 	"encoding/base64"
 	"json"
 	"log"
+	"url"
 )
 
 func init() {
@@ -34,7 +35,7 @@ func track(event, ip, id, song, user string) {
 		return
 	}
 
-	values := make(http.Values)
+	values := make(url.Values)
 	values.Add("data", base64.StdEncoding.EncodeToString(dataJSON))
 	r, err := http.PostForm("https://api.mixpanel.com/track/", values)
 	if err == nil {