Skip to content

Commit 6d064af

Browse files
committed
Updating to compile on weekly.2012-03-04
1 parent 34cf5e5 commit 6d064af

14 files changed

+28
-23
lines changed

examples/cats.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package main
33
import (
44
"mango"
55
"cats_middleware"
6-
"http"
6+
"net/http"
77
"os"
88
"io/ioutil"
99
)
@@ -39,4 +39,4 @@ func main() {
3939
stack.Middleware(cats_middleware) // Include the Cats middleware in our stack
4040

4141
stack.Run(Hello)
42-
}
42+
}

jsonp_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package mango
22

33
import (
4-
"http"
4+
"net/http"
55
"testing"
66
"runtime"
77
)

logger_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package mango
22

33
import (
44
"bytes"
5-
"http"
5+
"net/http"
66
"log"
77
"testing"
88
"runtime"

mango.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package mango
33

44
import (
55
"fmt"
6-
"http"
6+
"net/http"
77
"log"
88
"net/textproto"
99
"os"
@@ -138,7 +138,7 @@ func (this *Stack) HandlerFunc(app App) http.HandlerFunc {
138138
}
139139
}
140140

141-
func (this *Stack) Run(app App) os.Error {
141+
func (this *Stack) Run(app App) error {
142142
if this.Address == "" {
143143
this.Address = "0.0.0.0:8000"
144144
}

mango_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
package mango
22

33
import (
4-
"http/httptest"
4+
"net/http/httptest"
55
"io/ioutil"
66
"testing"
77
"fmt"
8-
"http"
8+
"net/http"
99
"runtime"
1010
)
1111

mime_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func TestRemovingMimeTypes(t *testing.T) {
5353
t.Error("Expected", value, "to have mime type:", expected, "got:", found)
5454
}
5555

56-
MimeTypes[".jpg"] = "", false
56+
delete(MimeTypes, ".jpg")
5757

5858
found = MimeType(value, fallback)
5959
if found != fallback {

redirect_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package mango
22

33
import (
4-
"http"
4+
"net/http"
55
"testing"
66
"runtime"
77
)

routing_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package mango
22

33
import (
4-
"http"
4+
"net/http"
55
"testing"
66
"runtime"
77
)

sessions.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,19 @@ import (
44
"bytes"
55
"hash"
66
"crypto/hmac"
7+
"crypto/sha1"
78
"encoding/base64"
89
"fmt"
910
"io/ioutil"
10-
"gob"
11-
"http"
11+
"encoding/gob"
12+
"net/http"
1213
"strings"
1314
)
1415

1516
func hashCookie(data, secret string) (sum string) {
16-
var h hash.Hash = hmac.NewSHA1([]byte(secret))
17+
var h hash.Hash = hmac.New(sha1.New, []byte(secret))
1718
h.Write([]byte(data))
18-
return string(h.Sum())
19+
return string(h.Sum(nil))
1920
}
2021

2122
func verifyCookie(data, secret, sum string) bool {

sessions_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package mango
22

33
import (
4-
"http"
4+
"net/http"
55
"runtime"
66
"strings"
77
"testing"

show_errors.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package mango
33
import (
44
"bytes"
55
"fmt"
6-
"template"
6+
"html/template"
77
)
88

99
func ShowErrors(templateString string) Middleware {

show_errors_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package mango
22

33
import (
4-
"http"
4+
"net/http"
55
"testing"
66
"runtime"
77
)

static.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,22 @@ import (
66
"os"
77
)
88

9+
func fileIsRegular(fi os.FileInfo) bool {
10+
return fi.Mode() & (os.ModeDir | os.ModeSymlink | os.ModeNamedPipe | os.ModeSocket | os.ModeDevice) == 0
11+
}
12+
913
func fileExists(filename string) bool {
1014
info, err := os.Stat(filename)
1115
if err != nil {
1216
return false
13-
} else if !info.IsRegular() {
14-
return false
15-
}
17+
} else if !fileIsRegular(info) {
18+
return false
19+
}
1620

1721
return true
1822
}
1923

20-
func readFile(filename string) (string, os.Error) {
24+
func readFile(filename string) (string, error) {
2125
body, err := ioutil.ReadFile(filename)
2226
return string(body), err
2327
}

static_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package mango
22

33
import (
44
"bytes"
5-
"http"
5+
"net/http"
66
"io/ioutil"
77
"testing"
88
"runtime"

0 commit comments

Comments
 (0)