From b6d5a8c1827e71ce158aa560f97b11cf66e37b2f Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Mon, 25 Sep 2023 18:08:04 +1300 Subject: [PATCH] Chore: Update internal import paths --- .github/workflows/tests.yml | 2 +- cmd/root.go | 2 +- cmd/version.go | 2 +- config/config.go | 4 ++-- internal/htmlcheck/css.go | 4 ++-- internal/htmlcheck/html.go | 2 +- internal/linkcheck/main.go | 2 +- internal/linkcheck/status.go | 2 +- internal/tools/message.go | 2 +- internal/updater/updater.go | 2 +- sendmail/cmd/cmd.go | 2 +- server/apiv1/api.go | 8 ++++---- server/apiv1/info.go | 2 +- server/apiv1/structs.go | 4 ++-- server/apiv1/thumbnails.go | 2 +- server/handlers/proxy.go | 2 +- server/server.go | 2 +- server/server_test.go | 2 +- server/smtpd/smtp.go | 2 +- server/smtpd/smtpd.go | 2 +- server/ui/api/v1/swagger.json | 16 ++++++++-------- server/websockets/client.go | 2 +- server/websockets/hub.go | 2 +- storage/database.go | 2 +- storage/migrationTasks.go | 2 +- storage/search.go | 4 ++-- storage/tags.go | 4 ++-- storage/test_shared.go | 2 +- storage/utils.go | 2 +- 29 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ff3a944..1b7fb31 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -24,7 +24,7 @@ jobs: key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} restore-keys: | ${{ runner.os }}-go- - - run: go test ./storage ./server ./utils/tools -v + - run: go test ./storage ./server ./internal/tools -v - run: go test ./storage -bench=. # build the assets diff --git a/cmd/root.go b/cmd/root.go index 7483e4c..90c4768 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -8,10 +8,10 @@ import ( "strings" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/server" "github.com/axllent/mailpit/server/smtpd" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/logger" "github.com/spf13/cobra" ) diff --git a/cmd/version.go b/cmd/version.go index a526cb1..2f1e155 100644 --- a/cmd/version.go +++ b/cmd/version.go @@ -6,7 +6,7 @@ import ( "runtime" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/updater" + "github.com/axllent/mailpit/internal/updater" "github.com/spf13/cobra" ) diff --git a/config/config.go b/config/config.go index 1ccc231..b76effc 100644 --- a/config/config.go +++ b/config/config.go @@ -10,8 +10,8 @@ import ( "regexp" "strings" - "github.com/axllent/mailpit/utils/logger" - "github.com/axllent/mailpit/utils/tools" + "github.com/axllent/mailpit/internal/logger" + "github.com/axllent/mailpit/internal/tools" "github.com/tg123/go-htpasswd" "gopkg.in/yaml.v3" ) diff --git a/internal/htmlcheck/css.go b/internal/htmlcheck/css.go index 16120bd..3a8f435 100644 --- a/internal/htmlcheck/css.go +++ b/internal/htmlcheck/css.go @@ -10,8 +10,8 @@ import ( "github.com/PuerkitoBio/goquery" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" - "github.com/axllent/mailpit/utils/tools" + "github.com/axllent/mailpit/internal/logger" + "github.com/axllent/mailpit/internal/tools" "github.com/vanng822/go-premailer/premailer" "golang.org/x/net/html" "golang.org/x/net/html/atom" diff --git a/internal/htmlcheck/html.go b/internal/htmlcheck/html.go index 8429e27..cf5ca12 100644 --- a/internal/htmlcheck/html.go +++ b/internal/htmlcheck/html.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/PuerkitoBio/goquery" - "github.com/axllent/mailpit/utils/tools" + "github.com/axllent/mailpit/internal/tools" ) // HTML tests diff --git a/internal/linkcheck/main.go b/internal/linkcheck/main.go index 50440de..c052608 100644 --- a/internal/linkcheck/main.go +++ b/internal/linkcheck/main.go @@ -6,8 +6,8 @@ import ( "strings" "github.com/PuerkitoBio/goquery" + "github.com/axllent/mailpit/internal/tools" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/tools" ) var linkRe = regexp.MustCompile(`(?m)\b(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:'!\/~+#-]*[\w@?^=%&\/~+#-])`) diff --git a/internal/linkcheck/status.go b/internal/linkcheck/status.go index 1b9acfc..96ba901 100644 --- a/internal/linkcheck/status.go +++ b/internal/linkcheck/status.go @@ -7,7 +7,7 @@ import ( "time" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" ) func getHTTPStatuses(links []string, followRedirects bool) []Link { diff --git a/internal/tools/message.go b/internal/tools/message.go index 5af68b1..b28cc18 100644 --- a/internal/tools/message.go +++ b/internal/tools/message.go @@ -7,7 +7,7 @@ import ( "net/mail" "regexp" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" ) // RemoveMessageHeaders scans a message for headers, if found them removes them. diff --git a/internal/updater/updater.go b/internal/updater/updater.go index 9acc638..4ea6bea 100644 --- a/internal/updater/updater.go +++ b/internal/updater/updater.go @@ -13,7 +13,7 @@ import ( "path/filepath" "runtime" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/semver" ) diff --git a/sendmail/cmd/cmd.go b/sendmail/cmd/cmd.go index 1dca1c9..44e9501 100644 --- a/sendmail/cmd/cmd.go +++ b/sendmail/cmd/cmd.go @@ -24,7 +24,7 @@ import ( "strings" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" "github.com/reiver/go-telnet" flag "github.com/spf13/pflag" ) diff --git a/server/apiv1/api.go b/server/apiv1/api.go index 07834c9..5c8c6a1 100644 --- a/server/apiv1/api.go +++ b/server/apiv1/api.go @@ -11,12 +11,12 @@ import ( "strings" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/htmlcheck" + "github.com/axllent/mailpit/internal/linkcheck" + "github.com/axllent/mailpit/internal/logger" + "github.com/axllent/mailpit/internal/tools" "github.com/axllent/mailpit/server/smtpd" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/htmlcheck" - "github.com/axllent/mailpit/utils/linkcheck" - "github.com/axllent/mailpit/utils/logger" - "github.com/axllent/mailpit/utils/tools" "github.com/gorilla/mux" uuid "github.com/satori/go.uuid" ) diff --git a/server/apiv1/info.go b/server/apiv1/info.go index d3cd471..7d07275 100644 --- a/server/apiv1/info.go +++ b/server/apiv1/info.go @@ -7,8 +7,8 @@ import ( "runtime" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/updater" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/updater" ) // Response includes the current and latest Mailpit version, database info, and memory usage diff --git a/server/apiv1/structs.go b/server/apiv1/structs.go index 7bdb5a0..38090bd 100644 --- a/server/apiv1/structs.go +++ b/server/apiv1/structs.go @@ -1,9 +1,9 @@ package apiv1 import ( + "github.com/axllent/mailpit/internal/htmlcheck" + "github.com/axllent/mailpit/internal/linkcheck" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/htmlcheck" - "github.com/axllent/mailpit/utils/linkcheck" ) // MessagesSummary is a summary of a list of messages diff --git a/server/apiv1/thumbnails.go b/server/apiv1/thumbnails.go index c90b3c7..4d1d593 100644 --- a/server/apiv1/thumbnails.go +++ b/server/apiv1/thumbnails.go @@ -10,8 +10,8 @@ import ( "net/http" "strings" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/logger" "github.com/disintegration/imaging" "github.com/gorilla/mux" "github.com/jhillyerd/enmime" diff --git a/server/handlers/proxy.go b/server/handlers/proxy.go index 292c9b6..afbaf8e 100644 --- a/server/handlers/proxy.go +++ b/server/handlers/proxy.go @@ -11,7 +11,7 @@ import ( "time" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" ) var linkRe = regexp.MustCompile(`(?i)^https?:\/\/`) diff --git a/server/server.go b/server/server.go index 6e683fb..e128813 100644 --- a/server/server.go +++ b/server/server.go @@ -15,11 +15,11 @@ import ( "text/template" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/server/apiv1" "github.com/axllent/mailpit/server/handlers" "github.com/axllent/mailpit/server/websockets" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/logger" "github.com/gorilla/mux" ) diff --git a/server/server_test.go b/server/server_test.go index 96499d8..5b45cfd 100644 --- a/server/server_test.go +++ b/server/server_test.go @@ -12,9 +12,9 @@ import ( "testing" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/server/apiv1" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/logger" "github.com/jhillyerd/enmime" ) diff --git a/server/smtpd/smtp.go b/server/smtpd/smtp.go index c1ae624..728adb1 100644 --- a/server/smtpd/smtp.go +++ b/server/smtpd/smtp.go @@ -8,7 +8,7 @@ import ( "net/smtp" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" ) func allowedRecipients(to []string) []string { diff --git a/server/smtpd/smtpd.go b/server/smtpd/smtpd.go index d78f4a5..20dfaa4 100644 --- a/server/smtpd/smtpd.go +++ b/server/smtpd/smtpd.go @@ -10,8 +10,8 @@ import ( "strings" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/storage" - "github.com/axllent/mailpit/utils/logger" "github.com/mhale/smtpd" uuid "github.com/satori/go.uuid" ) diff --git a/server/ui/api/v1/swagger.json b/server/ui/api/v1/swagger.json index 40366de..e9a1406 100644 --- a/server/ui/api/v1/swagger.json +++ b/server/ui/api/v1/swagger.json @@ -776,7 +776,7 @@ } }, "x-go-name": "Response", - "x-go-package": "github.com/axllent/mailpit/utils/htmlcheck" + "x-go-package": "github.com/axllent/mailpit/internal/htmlcheck" }, "HTMLCheckResult": { "description": "Result struct", @@ -808,7 +808,7 @@ } }, "x-go-name": "Result", - "x-go-package": "github.com/axllent/mailpit/utils/htmlcheck" + "x-go-package": "github.com/axllent/mailpit/internal/htmlcheck" }, "HTMLCheckScore": { "description": "Score struct", @@ -836,7 +836,7 @@ } }, "x-go-name": "Score", - "x-go-package": "github.com/axllent/mailpit/utils/htmlcheck" + "x-go-package": "github.com/axllent/mailpit/internal/htmlcheck" }, "HTMLCheckTotal": { "description": "Total weighted result for all scores", @@ -869,7 +869,7 @@ } }, "x-go-name": "Total", - "x-go-package": "github.com/axllent/mailpit/utils/htmlcheck" + "x-go-package": "github.com/axllent/mailpit/internal/htmlcheck" }, "HTMLCheckWarning": { "description": "Warning represents a failed test", @@ -925,7 +925,7 @@ } }, "x-go-name": "Warning", - "x-go-package": "github.com/axllent/mailpit/utils/htmlcheck" + "x-go-package": "github.com/axllent/mailpit/internal/htmlcheck" }, "Link": { "description": "Link struct", @@ -945,7 +945,7 @@ "type": "string" } }, - "x-go-package": "github.com/axllent/mailpit/utils/linkcheck" + "x-go-package": "github.com/axllent/mailpit/internal/linkcheck" }, "LinkCheckResponse": { "description": "Response represents the Link check response", @@ -965,7 +965,7 @@ } }, "x-go-name": "Response", - "x-go-package": "github.com/axllent/mailpit/utils/linkcheck" + "x-go-package": "github.com/axllent/mailpit/internal/linkcheck" }, "Message": { "description": "Message data excluding physical attachments", @@ -1335,4 +1335,4 @@ } } } -} \ No newline at end of file +} diff --git a/server/websockets/client.go b/server/websockets/client.go index ddb1e04..aebdcc8 100644 --- a/server/websockets/client.go +++ b/server/websockets/client.go @@ -9,7 +9,7 @@ import ( "time" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" "github.com/gorilla/websocket" ) diff --git a/server/websockets/hub.go b/server/websockets/hub.go index 049a749..4e492e1 100644 --- a/server/websockets/hub.go +++ b/server/websockets/hub.go @@ -7,7 +7,7 @@ package websockets import ( "encoding/json" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" ) // Hub maintains the set of active clients and broadcasts messages to the diff --git a/storage/database.go b/storage/database.go index 1800339..f7cbbee 100644 --- a/storage/database.go +++ b/storage/database.go @@ -20,8 +20,8 @@ import ( "github.com/GuiaBolso/darwin" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/server/websockets" - "github.com/axllent/mailpit/utils/logger" "github.com/jhillyerd/enmime" "github.com/klauspost/compress/zstd" "github.com/leporo/sqlf" diff --git a/storage/migrationTasks.go b/storage/migrationTasks.go index 12bd555..85f6bb8 100644 --- a/storage/migrationTasks.go +++ b/storage/migrationTasks.go @@ -8,7 +8,7 @@ import ( "time" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" "github.com/jhillyerd/enmime" "github.com/leporo/sqlf" "golang.org/x/text/language" diff --git a/storage/search.go b/storage/search.go index 98ed38d..9bd844d 100644 --- a/storage/search.go +++ b/storage/search.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/axllent/mailpit/utils/logger" - "github.com/axllent/mailpit/utils/tools" + "github.com/axllent/mailpit/internal/logger" + "github.com/axllent/mailpit/internal/tools" "github.com/leporo/sqlf" ) diff --git a/storage/tags.go b/storage/tags.go index 7b06407..d4f2521 100644 --- a/storage/tags.go +++ b/storage/tags.go @@ -7,8 +7,8 @@ import ( "strings" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" - "github.com/axllent/mailpit/utils/tools" + "github.com/axllent/mailpit/internal/logger" + "github.com/axllent/mailpit/internal/tools" "github.com/leporo/sqlf" ) diff --git a/storage/test_shared.go b/storage/test_shared.go index d17cfbd..03ce1e3 100644 --- a/storage/test_shared.go +++ b/storage/test_shared.go @@ -6,7 +6,7 @@ import ( "testing" "github.com/axllent/mailpit/config" - "github.com/axllent/mailpit/utils/logger" + "github.com/axllent/mailpit/internal/logger" ) var ( diff --git a/storage/utils.go b/storage/utils.go index 321ff8f..0637f08 100644 --- a/storage/utils.go +++ b/storage/utils.go @@ -10,8 +10,8 @@ import ( "time" "github.com/axllent/mailpit/config" + "github.com/axllent/mailpit/internal/logger" "github.com/axllent/mailpit/server/websockets" - "github.com/axllent/mailpit/utils/logger" "github.com/jhillyerd/enmime" "github.com/k3a/html2text" "github.com/leporo/sqlf"