diff --git a/gor.go b/gor.go index 9af6e93..bcec572 100644 --- a/gor.go +++ b/gor.go @@ -5,14 +5,14 @@ package main import ( "flag" "fmt" + "io" "log" "os" "os/signal" - "syscall" - "io" "runtime" _ "runtime/debug" "runtime/pprof" + "syscall" "time" ) @@ -56,16 +56,16 @@ func main() { c := make(chan os.Signal, 1) signal.Notify(c, os.Interrupt, syscall.SIGTERM) - go func(){ - <- c + go func() { + <-c - for _, p := range Plugins.All { + for _, p := range Plugins.All { if cp, ok := p.(io.Closer); ok { cp.Close() } } - os.Exit(1) + os.Exit(1) }() } diff --git a/http_client.go b/http_client.go index 6755ae0..b82da7f 100644 --- a/http_client.go +++ b/http_client.go @@ -10,9 +10,9 @@ import ( "runtime/debug" "strconv" "strings" + "sync" "syscall" "time" - "sync" ) var httpMu sync.Mutex diff --git a/input_raw.go b/input_raw.go index 9ff00ab..eb5bb1d 100644 --- a/input_raw.go +++ b/input_raw.go @@ -69,7 +69,7 @@ func (i *RAWInput) listen(address string) { ch := i.listener.Receiver() - go func(){ + go func() { for { select { case <-i.quit: diff --git a/plugins.go b/plugins.go index 754e5ec..c0ace99 100644 --- a/plugins.go +++ b/plugins.go @@ -4,19 +4,19 @@ import ( "io" "reflect" "strings" - "time" "sync" + "time" ) // InOutPlugins struct for holding references to plugins type InOutPlugins struct { Inputs []io.Reader Outputs []io.Writer - All []interface{} + All []interface{} } - var pluginMu sync.Mutex + // Plugins holds all the plugin objects var Plugins *InOutPlugins = new(InOutPlugins) diff --git a/raw_socket_listener/listener.go b/raw_socket_listener/listener.go index 4e700df..8a363f8 100644 --- a/raw_socket_listener/listener.go +++ b/raw_socket_listener/listener.go @@ -61,7 +61,7 @@ type Listener struct { messageExpire time.Duration - conn net.PacketConn + conn net.PacketConn pcapHandles []*pcap.Handle quit chan bool