Linting middlewares package

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2015-11-01 19:34:54 +01:00
parent 7766d0ddaa
commit 9387235a04
4 changed files with 11 additions and 15 deletions

View file

@ -1,6 +1,3 @@
/*
Copyright
*/
package middlewares
import (
@ -9,10 +6,12 @@ import (
"github.com/mailgun/oxy/cbreaker"
)
// CircuitBreaker holds the oxy circuit breaker.
type CircuitBreaker struct {
circuitBreaker *cbreaker.CircuitBreaker
}
// NewCircuitBreaker returns a new CircuitBreaker.
func NewCircuitBreaker(next http.Handler, expression string, options ...cbreaker.CircuitBreakerOption) *CircuitBreaker {
circuitBreaker, _ := cbreaker.New(next, expression, options...)
return &CircuitBreaker{circuitBreaker}

View file

@ -1,6 +1,3 @@
/*
Copyright
*/
package middlewares
import (
@ -16,7 +13,7 @@ type Logger struct {
file *os.File
}
// NewLogger returns a new Logger instance
// NewLogger returns a new Logger instance.
func NewLogger(file string) *Logger {
if len(file) > 0 {
fi, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
@ -36,6 +33,7 @@ func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.Ha
}
}
// Close closes the logger (i.e. the file).
func (l *Logger) Close() {
l.file.Close()
}

View file

@ -1,6 +1,3 @@
/*
Copyright
*/
package middlewares
import (
@ -11,10 +8,12 @@ import (
"github.com/gorilla/mux"
)
// Routes holds the gorilla mux routes (for the API & co).
type Routes struct {
router *mux.Router
}
// NewRoutes return a Routes based on the given router.
func NewRoutes(router *mux.Router) *Routes {
return &Routes{router}
}

View file

@ -1,20 +1,20 @@
/*
Copyright
*/
package middlewares
import (
log "github.com/Sirupsen/logrus"
"github.com/mailgun/oxy/roundrobin"
"net/http"
"strings"
"time"
log "github.com/Sirupsen/logrus"
"github.com/mailgun/oxy/roundrobin"
)
// WebsocketUpgrader holds Websocket configuration.
type WebsocketUpgrader struct {
rr *roundrobin.RoundRobin
}
// NewWebsocketUpgrader returns a new WebsocketUpgrader.
func NewWebsocketUpgrader(rr *roundrobin.RoundRobin) *WebsocketUpgrader {
wu := WebsocketUpgrader{
rr: rr,