diff --git a/api/application_test.go b/api/application_test.go index b0defb54..22504930 100644 --- a/api/application_test.go +++ b/api/application_test.go @@ -1,18 +1,16 @@ package api import ( - "math/rand" - "net/http/httptest" - "testing" - - "strings" - "bytes" "errors" "io" "io/ioutil" + "math/rand" "mime/multipart" + "net/http/httptest" "os" + "strings" + "testing" "github.com/gin-gonic/gin" "github.com/gotify/server/mode" diff --git a/api/client_test.go b/api/client_test.go index 1a9d8646..b9d74387 100644 --- a/api/client_test.go +++ b/api/client_test.go @@ -3,11 +3,9 @@ package api import ( "math/rand" "net/http/httptest" - "testing" - - "strings" - "net/url" + "strings" + "testing" "github.com/gin-gonic/gin" "github.com/gotify/server/mode" diff --git a/api/message.go b/api/message.go index b006c59a..478dcb1d 100644 --- a/api/message.go +++ b/api/message.go @@ -2,11 +2,10 @@ package api import ( "errors" + "strconv" "strings" "time" - "strconv" - "github.com/gin-gonic/gin" "github.com/gin-gonic/gin/binding" "github.com/gotify/location" diff --git a/api/message_test.go b/api/message_test.go index 64b79533..73f06bb4 100644 --- a/api/message_test.go +++ b/api/message_test.go @@ -2,21 +2,18 @@ package api import ( "net/http/httptest" + "net/url" + "strings" "testing" "time" "github.com/gin-gonic/gin" + "github.com/gotify/server/auth" "github.com/gotify/server/mode" "github.com/gotify/server/model" "github.com/gotify/server/test" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/suite" - - "strings" - - "net/url" - - "github.com/gotify/server/auth" ) func TestMessageSuite(t *testing.T) { diff --git a/api/stream/once.go b/api/stream/once.go index 83e0a2d1..4660b602 100644 --- a/api/stream/once.go +++ b/api/stream/once.go @@ -5,8 +5,8 @@ package stream import ( - "sync/atomic" "sync" + "sync/atomic" ) // Modified version of sync.Once (https://github.com/golang/go/blob/master/src/sync/once.go) @@ -25,7 +25,7 @@ func (o *once) Do(f func()) { } } -func (o *once) mayExecute() bool { +func (o *once) mayExecute() bool { o.m.Lock() defer o.m.Unlock() if o.done == 0 { @@ -33,4 +33,4 @@ func (o *once) mayExecute() bool { return true } return false -} \ No newline at end of file +} diff --git a/api/stream/stream.go b/api/stream/stream.go index 07a0784f..5a149d4b 100644 --- a/api/stream/stream.go +++ b/api/stream/stream.go @@ -1,13 +1,12 @@ package stream import ( + "net/http" + "net/url" "regexp" "sync" "time" - "net/http" - "net/url" - "github.com/gin-gonic/gin" "github.com/gorilla/websocket" "github.com/gotify/server/auth" diff --git a/api/stream/stream_test.go b/api/stream/stream_test.go index a6248d26..9118b3d7 100644 --- a/api/stream/stream_test.go +++ b/api/stream/stream_test.go @@ -3,6 +3,7 @@ package stream import ( "bytes" "encoding/json" + "errors" "fmt" "net/http" "net/http/httptest" @@ -10,8 +11,6 @@ import ( "testing" "time" - "errors" - "github.com/fortytw2/leaktest" "github.com/gin-gonic/gin" "github.com/gorilla/websocket" diff --git a/app.go b/app.go index 7027d2d5..970596e8 100644 --- a/app.go +++ b/app.go @@ -1,12 +1,10 @@ package main import ( - "math/rand" - "time" - "fmt" - + "math/rand" "os" + "time" "github.com/gotify/server/config" "github.com/gotify/server/database" diff --git a/config/config.go b/config/config.go index c80288c0..abf71566 100644 --- a/config/config.go +++ b/config/config.go @@ -44,7 +44,7 @@ type Configuration struct { // Get returns the configuration extracted from env variables or config file. func Get() *Configuration { conf := new(Configuration) - err := configor.New(&configor.Config{EnvironmentPrefix: "GOTIFY"}).Load(conf, "config.yml", "/etc/gotify/config.yml") + err := configor.New(&configor.Config{EnvironmentPrefix: "GOTIFY"}).Load(conf, "config.yml", "/etc/gotify/config.yml") if err != nil { panic(err) } diff --git a/config/config_test.go b/config/config_test.go index c4c64ddf..2dcf1940 100644 --- a/config/config_test.go +++ b/config/config_test.go @@ -2,9 +2,8 @@ package config import ( "os" - "testing" - "path/filepath" + "testing" "github.com/stretchr/testify/assert" ) diff --git a/docs/swagger.go b/docs/swagger.go index a52bd3a9..c68f5d3a 100644 --- a/docs/swagger.go +++ b/docs/swagger.go @@ -1,9 +1,10 @@ package docs import ( + "strings" + "github.com/gin-gonic/gin" "github.com/gobuffalo/packr" - "strings" ) // Serve serves the documentation. diff --git a/error/handler.go b/error/handler.go index dd23e380..eb081800 100644 --- a/error/handler.go +++ b/error/handler.go @@ -2,13 +2,11 @@ package error import ( "fmt" - - "github.com/gin-gonic/gin" - "net/http" "strings" "unicode" + "github.com/gin-gonic/gin" "github.com/gotify/server/model" "gopkg.in/go-playground/validator.v8" ) diff --git a/router/router.go b/router/router.go index dc2adf5c..706b0f15 100644 --- a/router/router.go +++ b/router/router.go @@ -1,24 +1,22 @@ package router import ( + "net/http" "time" "github.com/gin-gonic/gin" - "github.com/gotify/server/api" - "github.com/gotify/server/auth" - "github.com/gotify/server/database" - "github.com/gotify/server/error" - "github.com/gotify/server/ui" - "github.com/jmattheis/go-packr-swagger-ui" - - "net/http" - "github.com/gotify/location" + "github.com/gotify/server/api" "github.com/gotify/server/api/stream" + "github.com/gotify/server/auth" "github.com/gotify/server/config" + "github.com/gotify/server/database" "github.com/gotify/server/docs" + "github.com/gotify/server/error" "github.com/gotify/server/mode" "github.com/gotify/server/model" + "github.com/gotify/server/ui" + "github.com/jmattheis/go-packr-swagger-ui" ) // Create creates the gin engine with all routes. diff --git a/runner/runner.go b/runner/runner.go index 5860c21c..aa8348ba 100644 --- a/runner/runner.go +++ b/runner/runner.go @@ -3,11 +3,10 @@ package runner import ( "crypto/tls" "fmt" + "log" "net" "net/http" - "log" - "github.com/gin-gonic/gin" "github.com/gotify/server/config" "golang.org/x/crypto/acme/autocert"