Skip to content

Commit

Permalink
Updating to compile on weekly.2012-03-04
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbellamy committed Mar 10, 2012
1 parent 34cf5e5 commit 6d064af
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 23 deletions.
4 changes: 2 additions & 2 deletions examples/cats.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"mango"
"cats_middleware"
"http"
"net/http"
"os"
"io/ioutil"
)
Expand Down Expand Up @@ -39,4 +39,4 @@ func main() {
stack.Middleware(cats_middleware) // Include the Cats middleware in our stack

stack.Run(Hello)
}
}
2 changes: 1 addition & 1 deletion jsonp_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mango

import (
"http"
"net/http"
"testing"
"runtime"
)
Expand Down
2 changes: 1 addition & 1 deletion logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package mango

import (
"bytes"
"http"
"net/http"
"log"
"testing"
"runtime"
Expand Down
4 changes: 2 additions & 2 deletions mango.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mango

import (
"fmt"
"http"
"net/http"
"log"
"net/textproto"
"os"
Expand Down Expand Up @@ -138,7 +138,7 @@ func (this *Stack) HandlerFunc(app App) http.HandlerFunc {
}
}

func (this *Stack) Run(app App) os.Error {
func (this *Stack) Run(app App) error {
if this.Address == "" {
this.Address = "0.0.0.0:8000"
}
Expand Down
4 changes: 2 additions & 2 deletions mango_test.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package mango

import (
"http/httptest"
"net/http/httptest"
"io/ioutil"
"testing"
"fmt"
"http"
"net/http"
"runtime"
)

Expand Down
2 changes: 1 addition & 1 deletion mime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestRemovingMimeTypes(t *testing.T) {
t.Error("Expected", value, "to have mime type:", expected, "got:", found)
}

MimeTypes[".jpg"] = "", false
delete(MimeTypes, ".jpg")

found = MimeType(value, fallback)
if found != fallback {
Expand Down
2 changes: 1 addition & 1 deletion redirect_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mango

import (
"http"
"net/http"
"testing"
"runtime"
)
Expand Down
2 changes: 1 addition & 1 deletion routing_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mango

import (
"http"
"net/http"
"testing"
"runtime"
)
Expand Down
9 changes: 5 additions & 4 deletions sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ import (
"bytes"
"hash"
"crypto/hmac"
"crypto/sha1"
"encoding/base64"
"fmt"
"io/ioutil"
"gob"
"http"
"encoding/gob"
"net/http"
"strings"
)

func hashCookie(data, secret string) (sum string) {
var h hash.Hash = hmac.NewSHA1([]byte(secret))
var h hash.Hash = hmac.New(sha1.New, []byte(secret))
h.Write([]byte(data))
return string(h.Sum())
return string(h.Sum(nil))
}

func verifyCookie(data, secret, sum string) bool {
Expand Down
2 changes: 1 addition & 1 deletion sessions_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mango

import (
"http"
"net/http"
"runtime"
"strings"
"testing"
Expand Down
2 changes: 1 addition & 1 deletion show_errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package mango
import (
"bytes"
"fmt"
"template"
"html/template"
)

func ShowErrors(templateString string) Middleware {
Expand Down
2 changes: 1 addition & 1 deletion show_errors_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mango

import (
"http"
"net/http"
"testing"
"runtime"
)
Expand Down
12 changes: 8 additions & 4 deletions static.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ import (
"os"
)

func fileIsRegular(fi os.FileInfo) bool {
return fi.Mode() & (os.ModeDir | os.ModeSymlink | os.ModeNamedPipe | os.ModeSocket | os.ModeDevice) == 0
}

func fileExists(filename string) bool {
info, err := os.Stat(filename)
if err != nil {
return false
} else if !info.IsRegular() {
return false
}
} else if !fileIsRegular(info) {
return false
}

return true
}

func readFile(filename string) (string, os.Error) {
func readFile(filename string) (string, error) {
body, err := ioutil.ReadFile(filename)
return string(body), err
}
Expand Down
2 changes: 1 addition & 1 deletion static_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package mango

import (
"bytes"
"http"
"net/http"
"io/ioutil"
"testing"
"runtime"
Expand Down

0 comments on commit 6d064af

Please sign in to comment.