Format some file using gofmt

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
Vincent Demeester 2015-09-15 22:32:09 +02:00
parent 1cc294872b
commit fd835e1fcd
5 changed files with 26 additions and 26 deletions

View file

@ -2,15 +2,15 @@ package main
import ( import (
"bytes" "bytes"
"errors"
"github.com/BurntSushi/toml" "github.com/BurntSushi/toml"
"github.com/BurntSushi/ty/fun" "github.com/BurntSushi/ty/fun"
"github.com/cenkalti/backoff"
"github.com/fsouza/go-dockerclient" "github.com/fsouza/go-dockerclient"
"github.com/leekchan/gtf" "github.com/leekchan/gtf"
"github.com/cenkalti/backoff"
"strconv" "strconv"
"strings" "strings"
"text/template" "text/template"
"errors"
"time" "time"
) )
@ -45,7 +45,7 @@ var DockerFuncMap = template.FuncMap{
return value return value
} }
} }
for key, _ := range container.NetworkSettings.Ports { for key := range container.NetworkSettings.Ports {
return key.Port() return key.Port()
} }
return "" return ""
@ -85,7 +85,7 @@ func (provider *DockerProvider) Provide(configurationChan chan <- *Configuration
return errors.New("Docker event nil") return errors.New("Docker event nil")
// log.Fatalf("Docker connection error") // log.Fatalf("Docker connection error")
} }
if (event.Status == "start" || event.Status == "die" ) { if event.Status == "start" || event.Status == "die" {
log.Debug("Docker event receveived %+v", event) log.Debug("Docker event receveived %+v", event)
configuration := provider.loadDockerConfig(dockerClient) configuration := provider.loadDockerConfig(dockerClient)
if configuration != nil { if configuration != nil {

View file

@ -4,10 +4,10 @@ Copyright
package middlewares package middlewares
import ( import (
"github.com/gorilla/handlers"
"log" "log"
"net/http" "net/http"
"os" "os"
"github.com/gorilla/handlers"
) )
// Logger is a middleware handler that logs the request as it goes in and the response as it goes out. // Logger is a middleware handler that logs the request as it goes in and the response as it goes out.
@ -17,7 +17,7 @@ type Logger struct {
// NewLogger returns a new Logger instance // NewLogger returns a new Logger instance
func NewLogger(file string) *Logger { func NewLogger(file string) *Logger {
if (len(file) > 0 ) { if len(file) > 0 {
fi, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666) fi, err := os.OpenFile(file, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if err != nil { if err != nil {
log.Fatal("Error opening file", err) log.Fatal("Error opening file", err)
@ -29,7 +29,7 @@ func NewLogger(file string) *Logger {
} }
func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { func (l *Logger) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
if (l.file == nil) { if l.file == nil {
next(rw, r) next(rw, r)
} else { } else {
handlers.CombinedLoggingHandler(l.file, next).ServeHTTP(rw, r) handlers.CombinedLoggingHandler(l.file, next).ServeHTTP(rw, r)

View file

@ -4,10 +4,10 @@ Copyright
package middlewares package middlewares
import ( import (
"encoding/json"
"github.com/gorilla/mux"
"log" "log"
"net/http" "net/http"
"github.com/gorilla/mux"
"encoding/json"
) )
type Routes struct { type Routes struct {
@ -20,7 +20,7 @@ func NewRoutes(router *mux.Router) *Routes {
func (router *Routes) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) { func (router *Routes) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc) {
routeMatch := mux.RouteMatch{} routeMatch := mux.RouteMatch{}
if(router.router.Match(r, &routeMatch)){ if router.router.Match(r, &routeMatch) {
json, _ := json.Marshal(routeMatch.Handler) json, _ := json.Marshal(routeMatch.Handler)
log.Println("Request match route ", json) log.Println("Request match route ", json)
} }

View file

@ -215,7 +215,7 @@ func LoadConfig(configuration *Configuration, gloablConfiguration *GlobalConfigu
func Invoke(any interface{}, name string, args ...interface{}) []reflect.Value { func Invoke(any interface{}, name string, args ...interface{}) []reflect.Value {
inputs := make([]reflect.Value, len(args)) inputs := make([]reflect.Value, len(args))
for i, _ := range args { for i := range args {
inputs[i] = reflect.ValueOf(args[i]) inputs[i] = reflect.ValueOf(args[i])
} }
return reflect.ValueOf(any).MethodByName(name).Call(inputs) return reflect.ValueOf(any).MethodByName(name).Call(inputs)