diff --git a/config/config.go b/config/config.go index bcf4c2b..280bd38 100644 --- a/config/config.go +++ b/config/config.go @@ -3,10 +3,11 @@ package config import ( "container/list" "fmt" - "github.com/robfig/config" "net" "os" "strings" + + "github.com/robfig/config" ) // SmtpConfig houses the SMTP server configuration - not using pointers diff --git a/inbucket.go b/inbucket.go index 76bebc4..c79e049 100644 --- a/inbucket.go +++ b/inbucket.go @@ -7,16 +7,17 @@ import ( "expvar" "flag" "fmt" - "github.com/jhillyerd/inbucket/config" - "github.com/jhillyerd/inbucket/log" - "github.com/jhillyerd/inbucket/pop3d" - "github.com/jhillyerd/inbucket/smtpd" - "github.com/jhillyerd/inbucket/web" golog "log" "os" "os/signal" "syscall" "time" + + "github.com/jhillyerd/inbucket/config" + "github.com/jhillyerd/inbucket/log" + "github.com/jhillyerd/inbucket/pop3d" + "github.com/jhillyerd/inbucket/smtpd" + "github.com/jhillyerd/inbucket/web" ) var ( diff --git a/pop3d/handler.go b/pop3d/handler.go index f2fa33c..6d7beb0 100644 --- a/pop3d/handler.go +++ b/pop3d/handler.go @@ -4,14 +4,15 @@ import ( "bufio" "bytes" "fmt" - "github.com/jhillyerd/inbucket/log" - "github.com/jhillyerd/inbucket/smtpd" "io" "net" "os" "strconv" "strings" "time" + + "github.com/jhillyerd/inbucket/log" + "github.com/jhillyerd/inbucket/smtpd" ) type State int diff --git a/pop3d/listener.go b/pop3d/listener.go index 17c1253..ef482c8 100644 --- a/pop3d/listener.go +++ b/pop3d/listener.go @@ -2,12 +2,13 @@ package pop3d import ( "fmt" - "github.com/jhillyerd/inbucket/config" - "github.com/jhillyerd/inbucket/log" - "github.com/jhillyerd/inbucket/smtpd" "net" "sync" "time" + + "github.com/jhillyerd/inbucket/config" + "github.com/jhillyerd/inbucket/log" + "github.com/jhillyerd/inbucket/smtpd" ) // Real server code starts here diff --git a/smtpd/datastore.go b/smtpd/datastore.go index 2dd1239..1bde5a2 100644 --- a/smtpd/datastore.go +++ b/smtpd/datastore.go @@ -2,10 +2,11 @@ package smtpd import ( "errors" - "github.com/jhillyerd/go.enmime" "io" "net/mail" "time" + + "github.com/jhillyerd/go.enmime" ) var ErrNotExist = errors.New("Message does not exist") diff --git a/smtpd/filestore.go b/smtpd/filestore.go index 9f9fc33..e081102 100644 --- a/smtpd/filestore.go +++ b/smtpd/filestore.go @@ -5,9 +5,6 @@ import ( "encoding/gob" "errors" "fmt" - "github.com/jhillyerd/go.enmime" - "github.com/jhillyerd/inbucket/config" - "github.com/jhillyerd/inbucket/log" "io" "io/ioutil" "net/mail" @@ -15,6 +12,10 @@ import ( "path/filepath" "sync" "time" + + "github.com/jhillyerd/go.enmime" + "github.com/jhillyerd/inbucket/config" + "github.com/jhillyerd/inbucket/log" ) // Name of index file in each mailbox diff --git a/smtpd/filestore_test.go b/smtpd/filestore_test.go index cb21277..6f8b97a 100644 --- a/smtpd/filestore_test.go +++ b/smtpd/filestore_test.go @@ -3,8 +3,6 @@ package smtpd import ( "bytes" "fmt" - "github.com/jhillyerd/inbucket/config" - "github.com/stretchr/testify/assert" "io" "io/ioutil" "log" @@ -12,6 +10,9 @@ import ( "path/filepath" "testing" "time" + + "github.com/jhillyerd/inbucket/config" + "github.com/stretchr/testify/assert" ) // Test directory structure created by filestore diff --git a/smtpd/handler.go b/smtpd/handler.go index b0b022a..4b0558e 100644 --- a/smtpd/handler.go +++ b/smtpd/handler.go @@ -5,13 +5,14 @@ import ( "bytes" "container/list" "fmt" - "github.com/jhillyerd/inbucket/log" "io" "net" "regexp" "strconv" "strings" "time" + + "github.com/jhillyerd/inbucket/log" ) type State int diff --git a/smtpd/handler_test.go b/smtpd/handler_test.go index 1ec31a8..9434aae 100644 --- a/smtpd/handler_test.go +++ b/smtpd/handler_test.go @@ -3,8 +3,9 @@ package smtpd import ( "bytes" "fmt" - "github.com/jhillyerd/inbucket/config" "io" + + "github.com/jhillyerd/inbucket/config" //"io/ioutil" "log" "net" diff --git a/smtpd/listener.go b/smtpd/listener.go index d351c8f..7072211 100644 --- a/smtpd/listener.go +++ b/smtpd/listener.go @@ -4,12 +4,13 @@ import ( "container/list" "expvar" "fmt" - "github.com/jhillyerd/inbucket/config" - "github.com/jhillyerd/inbucket/log" "net" "strings" "sync" "time" + + "github.com/jhillyerd/inbucket/config" + "github.com/jhillyerd/inbucket/log" ) // Real server code starts here diff --git a/smtpd/retention.go b/smtpd/retention.go index 5deba32..f17a6af 100644 --- a/smtpd/retention.go +++ b/smtpd/retention.go @@ -3,10 +3,11 @@ package smtpd import ( "container/list" "expvar" - "github.com/jhillyerd/inbucket/config" - "github.com/jhillyerd/inbucket/log" "sync" "time" + + "github.com/jhillyerd/inbucket/config" + "github.com/jhillyerd/inbucket/log" ) var retentionScanCompleted time.Time @@ -30,8 +31,8 @@ func StartRetentionScanner(ds DataStore) { if cfg.RetentionMinutes > 0 { // Retention scanning enabled log.LogInfo("Retention configured for %v minutes", cfg.RetentionMinutes) - go retentionScanner(ds, time.Duration(cfg.RetentionMinutes) * time.Minute, - time.Duration(cfg.RetentionSleep) * time.Millisecond) + go retentionScanner(ds, time.Duration(cfg.RetentionMinutes)*time.Minute, + time.Duration(cfg.RetentionSleep)*time.Millisecond) } else { log.LogInfo("Retention scanner disabled") } diff --git a/smtpd/retention_test.go b/smtpd/retention_test.go index 82b6511..d85e511 100644 --- a/smtpd/retention_test.go +++ b/smtpd/retention_test.go @@ -2,12 +2,13 @@ package smtpd import ( "fmt" - "github.com/jhillyerd/go.enmime" - "github.com/stretchr/testify/mock" "io" "net/mail" "testing" "time" + + "github.com/jhillyerd/go.enmime" + "github.com/stretchr/testify/mock" ) func TestDoRetentionScan(t *testing.T) { diff --git a/web/context.go b/web/context.go index 82ba8be..0eda5dd 100644 --- a/web/context.go +++ b/web/context.go @@ -1,11 +1,12 @@ package web import ( + "net/http" + "strings" + "github.com/gorilla/mux" "github.com/gorilla/sessions" "github.com/jhillyerd/inbucket/smtpd" - "net/http" - "strings" ) type Context struct { diff --git a/web/helpers.go b/web/helpers.go index 5f80bf4..1f06dab 100644 --- a/web/helpers.go +++ b/web/helpers.go @@ -2,12 +2,13 @@ package web import ( "fmt" - "github.com/jhillyerd/inbucket/log" "html" "html/template" "regexp" "strings" "time" + + "github.com/jhillyerd/inbucket/log" ) var TemplateFuncs = template.FuncMap{ diff --git a/web/helpers_test.go b/web/helpers_test.go index 85298eb..6c6c9ae 100644 --- a/web/helpers_test.go +++ b/web/helpers_test.go @@ -1,9 +1,10 @@ package web import ( - "github.com/stretchr/testify/assert" "html/template" "testing" + + "github.com/stretchr/testify/assert" ) func TestTextToHtml(t *testing.T) { diff --git a/web/mailbox_controller.go b/web/mailbox_controller.go index 1a01d53..f42f1b9 100644 --- a/web/mailbox_controller.go +++ b/web/mailbox_controller.go @@ -2,14 +2,15 @@ package web import ( "fmt" - "github.com/jhillyerd/inbucket/log" - "github.com/jhillyerd/inbucket/smtpd" "html/template" "io" "net/http" "net/mail" "strconv" "time" + + "github.com/jhillyerd/inbucket/log" + "github.com/jhillyerd/inbucket/smtpd" ) type JsonMessageHeader struct { diff --git a/web/rest_test.go b/web/rest_test.go index 85f5fdf..b50b1ab 100644 --- a/web/rest_test.go +++ b/web/rest_test.go @@ -4,10 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/jhillyerd/go.enmime" - "github.com/jhillyerd/inbucket/config" - "github.com/jhillyerd/inbucket/smtpd" - "github.com/stretchr/testify/mock" "io" "log" "net/http" @@ -16,6 +12,11 @@ import ( "os" "testing" "time" + + "github.com/jhillyerd/go.enmime" + "github.com/jhillyerd/inbucket/config" + "github.com/jhillyerd/inbucket/smtpd" + "github.com/stretchr/testify/mock" ) type OutputJsonHeader struct { diff --git a/web/root_controller.go b/web/root_controller.go index a0c68b4..b7d2c1c 100644 --- a/web/root_controller.go +++ b/web/root_controller.go @@ -2,10 +2,11 @@ package web import ( "fmt" - "github.com/jhillyerd/inbucket/config" "html/template" "io/ioutil" "net/http" + + "github.com/jhillyerd/inbucket/config" ) func RootIndex(w http.ResponseWriter, req *http.Request, ctx *Context) (err error) { diff --git a/web/server.go b/web/server.go index 4c6de81..461ed62 100644 --- a/web/server.go +++ b/web/server.go @@ -5,15 +5,16 @@ package web import ( "fmt" + "net" + "net/http" + "time" + "github.com/goods/httpbuf" "github.com/gorilla/mux" "github.com/gorilla/sessions" "github.com/jhillyerd/inbucket/config" "github.com/jhillyerd/inbucket/log" "github.com/jhillyerd/inbucket/smtpd" - "net" - "net/http" - "time" ) type handler func(http.ResponseWriter, *http.Request, *Context) error diff --git a/web/template.go b/web/template.go index da6346f..b0aa105 100644 --- a/web/template.go +++ b/web/template.go @@ -1,13 +1,14 @@ package web import ( - "github.com/jhillyerd/inbucket/log" "html/template" "net/http" "path" "path/filepath" "strings" "sync" + + "github.com/jhillyerd/inbucket/log" ) var cachedMutex sync.Mutex