diff --git a/cmd/client/mbox.go b/cmd/client/mbox.go index 38ebd7b..c8cc849 100644 --- a/cmd/client/mbox.go +++ b/cmd/client/mbox.go @@ -70,7 +70,7 @@ func outputMbox(headers []*client.MessageHeader) error { for _, h := range headers { source, err := h.GetSource() if err != nil { - return fmt.Errorf("Get source REST failed: %v", err) + return fmt.Errorf("get source REST failed: %v", err) } fmt.Printf("From %s\n", h.From) diff --git a/pkg/config/config.go b/pkg/config/config.go index e7e351b..7c6f852 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -51,7 +51,7 @@ func (n *mbNaming) Decode(v string) error { case "domain": *n = DomainNaming default: - return fmt.Errorf("Unknown MailboxNaming strategy: %q", v) + return fmt.Errorf("unknown MailboxNaming strategy: %q", v) } return nil } diff --git a/pkg/extension/async_broker.go b/pkg/extension/async_broker.go index d13362d..368fee8 100644 --- a/pkg/extension/async_broker.go +++ b/pkg/extension/async_broker.go @@ -83,7 +83,7 @@ func (eb *AsyncEventBroker[E]) AsyncTestListener(name string, capacity int) func return &event, nil case <-time.After(time.Second * 2): - return nil, errors.New("Timeout waiting for event") + return nil, errors.New("timeout waiting for event") } } } diff --git a/pkg/extension/host.go b/pkg/extension/host.go index 2832744..c22ff1e 100644 --- a/pkg/extension/host.go +++ b/pkg/extension/host.go @@ -18,7 +18,7 @@ type Host struct { // // After-events allow extensions to take an action after an event has completed. These events are // processed asynchronously with respect to the rest of Inbuckets operation. However, an event -// listener will not be called until the one before it complets. +// listener will not be called until the one before it completes. type Events struct { AfterMessageDeleted AsyncEventBroker[event.MessageMetadata] AfterMessageStored AsyncEventBroker[event.MessageMetadata] diff --git a/pkg/message/manager.go b/pkg/message/manager.go index 25dedf9..eec8199 100644 --- a/pkg/message/manager.go +++ b/pkg/message/manager.go @@ -110,7 +110,7 @@ func (s *StoreManager) Deliver( // Deliver to each mailbox. for _, mb := range inbound.Mailboxes { - // Append recipient and timestamp to generated Recieved header. + // Append recipient and timestamp to generated Received header. recvd := fmt.Sprintf("%s for <%s>; %s\r\n", recvdHeader, mb, tstamp) // Deliver message. diff --git a/pkg/message/manager_test.go b/pkg/message/manager_test.go index f2ae1a0..9f19ad2 100644 --- a/pkg/message/manager_test.go +++ b/pkg/message/manager_test.go @@ -352,7 +352,7 @@ func TestDeliverBeforeAndAfterMessageStoredEvents(t *testing.T) { t.Fatal(err) } - // Confirm mailbox names overriden by Before were sent to After event. Order is + // Confirm mailbox names overridden by `Before` were sent to `After` event. Order is // not guaranteed. got1, err := listener() require.NoError(t, err) diff --git a/pkg/policy/address.go b/pkg/policy/address.go index be46acb..dfb95bd 100644 --- a/pkg/policy/address.go +++ b/pkg/policy/address.go @@ -37,7 +37,7 @@ func (a *Addressing) ExtractMailbox(address string) (string, error) { } if a.Config.MailboxNaming != config.FullNaming { - return "", fmt.Errorf("Unknown MailboxNaming value: %v", a.Config.MailboxNaming) + return "", fmt.Errorf("unknown MailboxNaming value: %v", a.Config.MailboxNaming) } if domain == "" { diff --git a/pkg/policy/address_test.go b/pkg/policy/address_test.go index bbb7ea0..3d8eb69 100644 --- a/pkg/policy/address_test.go +++ b/pkg/policy/address_test.go @@ -33,7 +33,6 @@ func TestShouldAcceptDomain(t *testing.T) { if got != tc.want { t.Errorf("Got %v for %q, want: %v", got, tc.domain, tc.want) } - }) } // Test with default reject. @@ -60,7 +59,6 @@ func TestShouldAcceptDomain(t *testing.T) { if got != tc.want { t.Errorf("Got %v for %q, want: %v", got, tc.domain, tc.want) } - }) } } @@ -90,7 +88,6 @@ func TestShouldStoreDomain(t *testing.T) { if got != tc.want { t.Errorf("Got store %v for %q, want: %v", got, tc.domain, tc.want) } - }) } // Test with storage disabled. @@ -117,7 +114,6 @@ func TestShouldStoreDomain(t *testing.T) { if got != tc.want { t.Errorf("Got store %v for %q, want: %v", got, tc.domain, tc.want) } - }) } } diff --git a/pkg/rest/client/rest_test.go b/pkg/rest/client/rest_test.go index 563e57f..f8b6260 100644 --- a/pkg/rest/client/rest_test.go +++ b/pkg/rest/client/rest_test.go @@ -65,16 +65,16 @@ func TestDoTable(t *testing.T) { uri string wantMethod string base *url.URL - wantUrl string + wantURL string wantBody []byte }{ - {method: "GET", wantMethod: "GET", uri: "/doget", base: baseURL, wantUrl: baseURLStr + "/doget", wantBody: []byte("Test body 1")}, - {method: "POST", wantMethod: "POST", uri: "/dopost", base: baseURL, wantUrl: baseURLStr + "/dopost", wantBody: []byte("Test body 2")}, - {method: "GET", wantMethod: "GET", uri: "/doget", base: baseURLPath, wantUrl: baseURLPathStr + "/doget", wantBody: []byte("Test body 3")}, - {method: "POST", wantMethod: "POST", uri: "/dopost", base: baseURLPath, wantUrl: baseURLPathStr + "/dopost", wantBody: []byte("Test body 4")}, + {method: "GET", wantMethod: "GET", uri: "/doget", base: baseURL, wantURL: baseURLStr + "/doget", wantBody: []byte("Test body 1")}, + {method: "POST", wantMethod: "POST", uri: "/dopost", base: baseURL, wantURL: baseURLStr + "/dopost", wantBody: []byte("Test body 2")}, + {method: "GET", wantMethod: "GET", uri: "/doget", base: baseURLPath, wantURL: baseURLPathStr + "/doget", wantBody: []byte("Test body 3")}, + {method: "POST", wantMethod: "POST", uri: "/dopost", base: baseURLPath, wantURL: baseURLPathStr + "/dopost", wantBody: []byte("Test body 4")}, } for _, test := range tests { - testname := fmt.Sprintf("%s,%s", test.method, test.wantUrl) + testname := fmt.Sprintf("%s,%s", test.method, test.wantURL) t.Run(testname, func(t *testing.T) { mth := &mockHTTPClient{} c := &restClient{mth, test.base} @@ -85,8 +85,8 @@ func TestDoTable(t *testing.T) { if mth.req.Method != test.wantMethod { t.Errorf("req.Method == %q, want %q", mth.req.Method, test.wantMethod) } - if mth.req.URL.String() != test.wantUrl { - t.Errorf("req.URL == %q, want %q", mth.req.URL.String(), test.wantUrl) + if mth.req.URL.String() != test.wantURL { + t.Errorf("req.URL == %q, want %q", mth.req.URL.String(), test.wantURL) } if !bytes.Equal(mth.ReqBody(), test.wantBody) { t.Errorf("req.Body == %q, want %q", mth.ReqBody(), test.wantBody) diff --git a/pkg/rest/routes.go b/pkg/rest/routes.go index 7d05f58..e05e94b 100644 --- a/pkg/rest/routes.go +++ b/pkg/rest/routes.go @@ -1,7 +1,9 @@ package rest -import "github.com/gorilla/mux" -import "github.com/inbucket/inbucket/v3/pkg/server/web" +import ( + "github.com/gorilla/mux" + "github.com/inbucket/inbucket/v3/pkg/server/web" +) // SetupRoutes populates the routes for the REST interface func SetupRoutes(r *mux.Router) { diff --git a/pkg/server/pop3/handler.go b/pkg/server/pop3/handler.go index beb1bf2..93506bf 100644 --- a/pkg/server/pop3/handler.go +++ b/pkg/server/pop3/handler.go @@ -463,7 +463,7 @@ func (s *Session) transactionHandler(cmd string, args []string) { s.processDeletes() s.enterState(QUIT) case "NOOP": - s.send("+OK I have sucessfully done nothing") + s.send("+OK I have successfully done nothing") case "RSET": // Reset session, don't actually delete anything I told you to s.logger.Debug().Msgf("Resetting session state on RSET request") diff --git a/pkg/server/smtp/handler.go b/pkg/server/smtp/handler.go index 8a0e467..5cec8a3 100644 --- a/pkg/server/smtp/handler.go +++ b/pkg/server/smtp/handler.go @@ -206,7 +206,7 @@ func (s *Server) startSession(id int, conn net.Conn, logger zerolog.Logger) { ssn.send("252 Cannot VRFY user, but will accept message") continue case "NOOP": - ssn.send("250 I have sucessfully done nothing") + ssn.send("250 I have successfully done nothing") continue case "RSET": // Reset session diff --git a/pkg/server/smtp/handler_test.go b/pkg/server/smtp/handler_test.go index c6395c5..7aa790d 100644 --- a/pkg/server/smtp/handler_test.go +++ b/pkg/server/smtp/handler_test.go @@ -222,7 +222,6 @@ func TestReadyStateRejectedDomains(t *testing.T) { } }) } - } // Test invalid commands in READY state. @@ -255,7 +254,6 @@ func TestReadyStateInvalidCommands(t *testing.T) { } }) } - } // Test commands in MAIL state @@ -562,7 +560,6 @@ func TestBeforeMailAcceptedEventResponse(t *testing.T) { assert.NotNil(t, gotEvent, "BeforeMailListener did not receive Address") }) } - } // net.Pipe does not implement deadlines diff --git a/pkg/server/web/server.go b/pkg/server/web/server.go index 1e4a266..1c8f04b 100644 --- a/pkg/server/web/server.go +++ b/pkg/server/web/server.go @@ -51,11 +51,7 @@ type Server struct { } // NewServer sets up things for unit tests or the Start() method. -func NewServer( - conf *config.Root, - mm message.Manager, - mh *msghub.Hub) *Server { - +func NewServer(conf *config.Root, mm message.Manager, mh *msghub.Hub) *Server { rootConfig = conf // NewContext() will use this DataStore for the web handlers. diff --git a/pkg/storage/lock.go b/pkg/storage/lock.go index 8612e80..d1e0c2d 100644 --- a/pkg/storage/lock.go +++ b/pkg/storage/lock.go @@ -9,7 +9,7 @@ import ( // access in most cases without requiring an infinite number of mutexes. type HashLock [4096]sync.RWMutex -// Get returns a RWMutex based on the first 12 bits of the mailbox hash. Hash must be a hexidecimal +// Get returns a RWMutex based on the first 12 bits of the mailbox hash. Hash must be a hexadecimal // string of three or more characters. func (h *HashLock) Get(hash string) *sync.RWMutex { if len(hash) < 3 { diff --git a/pkg/storage/lock_test.go b/pkg/storage/lock_test.go index d65d064..fa58309 100644 --- a/pkg/storage/lock_test.go +++ b/pkg/storage/lock_test.go @@ -36,7 +36,7 @@ func TestHashLock(t *testing.T) { t.Run(ts, func(t *testing.T) { l := hl.Get(ts) if l == nil { - t.Errorf("Expeced non-nil lock for hex string %q", ts) + t.Errorf("Expected non-nil lock for hex string %q", ts) } }) } diff --git a/pkg/storage/mem/store.go b/pkg/storage/mem/store.go index 6d51152..7e60f72 100644 --- a/pkg/storage/mem/store.go +++ b/pkg/storage/mem/store.go @@ -33,7 +33,7 @@ type mbox struct { var _ storage.Store = &Store{} -// New returns an emtpy memory store. +// New returns an empty memory store. func New(cfg config.Storage, extHost *extension.Host) (storage.Store, error) { s := &Store{ boxes: make(map[string]*mbox), diff --git a/pkg/stringutil/utils.go b/pkg/stringutil/utils.go index f463727..e303eba 100644 --- a/pkg/stringutil/utils.go +++ b/pkg/stringutil/utils.go @@ -95,11 +95,9 @@ func MatchWithWildcards(p string, s string) bool { if runePattern[j-1] == '*' { isMatchingMatrix[0][j] = isMatchingMatrix[0][j-1] } - } for i := 1; i <= lenInput; i++ { for j := 1; j <= lenPattern; j++ { - if runePattern[j-1] == '*' { isMatchingMatrix[i][j] = isMatchingMatrix[i-1][j] || isMatchingMatrix[i][j-1] } diff --git a/pkg/webui/sanitize/css_test.go b/pkg/webui/sanitize/css_test.go index dc72a82..7fee26c 100644 --- a/pkg/webui/sanitize/css_test.go +++ b/pkg/webui/sanitize/css_test.go @@ -30,5 +30,4 @@ func TestSanitizeStyle(t *testing.T) { } }) } - }