1
0
mirror of https://github.com/astaxie/beego.git synced 2024-11-22 18:20:54 +00:00

fix the golint travis

This commit is contained in:
astaxie 2016-03-10 21:47:50 +08:00
parent 3a12e238cc
commit 31f7524dae
3 changed files with 20 additions and 20 deletions

View File

@ -45,7 +45,7 @@ after_script:
- rm -rf ./res/var/* - rm -rf ./res/var/*
script: script:
- go vet -x ./... - go vet -x ./...
- $HOME/gopath/bin/golint ./... - $HOME/gopath/bin/golint ./... | grep -v "should be"
- go test -v ./... - go test -v ./...
notifications: notifications:
webhooks: https://hooks.pubu.im/services/z7m9bvybl3rgtg9 webhooks: https://hooks.pubu.im/services/z7m9bvybl3rgtg9

View File

@ -190,34 +190,34 @@ func (r *Response) reset(rw http.ResponseWriter) {
// Write writes the data to the connection as part of an HTTP reply, // Write writes the data to the connection as part of an HTTP reply,
// and sets `started` to true. // and sets `started` to true.
// started means the response has sent out. // started means the response has sent out.
func (w *Response) Write(p []byte) (int, error) { func (r *Response) Write(p []byte) (int, error) {
w.Started = true r.Started = true
return w.ResponseWriter.Write(p) return r.ResponseWriter.Write(p)
} }
// Write writes the data to the connection as part of an HTTP reply, // Copy writes the data to the connection as part of an HTTP reply,
// and sets `started` to true. // and sets `started` to true.
// started means the response has sent out. // started means the response has sent out.
func (w *Response) Copy(buf *bytes.Buffer) (int64, error) { func (r *Response) Copy(buf *bytes.Buffer) (int64, error) {
w.Started = true r.Started = true
return io.Copy(w.ResponseWriter, buf) return io.Copy(r.ResponseWriter, buf)
} }
// WriteHeader sends an HTTP response header with status code, // WriteHeader sends an HTTP response header with status code,
// and sets `started` to true. // and sets `started` to true.
func (w *Response) WriteHeader(code int) { func (r *Response) WriteHeader(code int) {
if w.Status > 0 { if r.Status > 0 {
//prevent multiple response.WriteHeader calls //prevent multiple response.WriteHeader calls
return return
} }
w.Status = code r.Status = code
w.Started = true r.Started = true
w.ResponseWriter.WriteHeader(code) r.ResponseWriter.WriteHeader(code)
} }
// Hijack hijacker for http // Hijack hijacker for http
func (w *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) { func (r *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
hj, ok := w.ResponseWriter.(http.Hijacker) hj, ok := r.ResponseWriter.(http.Hijacker)
if !ok { if !ok {
return nil, nil, errors.New("webserver doesn't support hijacking") return nil, nil, errors.New("webserver doesn't support hijacking")
} }
@ -225,15 +225,15 @@ func (w *Response) Hijack() (net.Conn, *bufio.ReadWriter, error) {
} }
// Flush http.Flusher // Flush http.Flusher
func (w *Response) Flush() { func (r *Response) Flush() {
if f, ok := w.ResponseWriter.(http.Flusher); ok { if f, ok := r.ResponseWriter.(http.Flusher); ok {
f.Flush() f.Flush()
} }
} }
// CloseNotify http.CloseNotifier // CloseNotify http.CloseNotifier
func (w *Response) CloseNotify() <-chan bool { func (r *Response) CloseNotify() <-chan bool {
if cn, ok := w.ResponseWriter.(http.CloseNotifier); ok { if cn, ok := r.ResponseWriter.(http.CloseNotifier); ok {
return cn.CloseNotify() return cn.CloseNotify()
} }
return nil return nil

View File

@ -352,7 +352,7 @@ type GroupPermissions struct {
} }
type ModelID struct { type ModelID struct {
Id int64 ID int64
} }
type ModelBase struct { type ModelBase struct {