Skip to content

Commit

Permalink
refactor(context): use new on empty struct literals
Browse files Browse the repository at this point in the history
  • Loading branch information
bastean committed Feb 4, 2025
1 parent b864943 commit c6e30c6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/context/shared/domain/errors/bubble_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func (s *BubbleTestSuite) TestWithValidValue() {
}

func (s *BubbleTestSuite) TestWithInvalidValue() {
s.Panics(func() { errors.New[errors.Default](&errors.Bubble{}) })
s.Panics(func() { errors.New[errors.Default](new(errors.Bubble)) })
}

func TestUnitBubbleSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/shared/domain/messages/key_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func (s *KeyTestSuite) TestWithValidValue() {
}

func (s *KeyTestSuite) TestWithInvalidValue() {
s.Panics(func() { messages.NewKey(&messages.KeyComponents{}) })
s.Panics(func() { messages.NewKey(new(messages.KeyComponents)) })
}

func TestUnitKeySuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/shared/domain/messages/recipient_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (s *RecipientTestSuite) TestWithValidValue() {
}

func (s *RecipientTestSuite) TestWithInvalidValue() {
s.Panics(func() { messages.NewRecipient(&messages.RecipientComponents{}) })
s.Panics(func() { messages.NewRecipient(new(messages.RecipientComponents)) })
}

func TestUnitRecipientSuite(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/user/application/forgot/case.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (c *Case) Run(reset *user.ID, email *user.Email) (*user.User, error) {
Email: aggregate.Email.Value,
Username: aggregate.Username.Value,
},
&events.UserResetQueuedMeta{},
new(events.UserResetQueuedMeta),
))

return aggregate, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/user/application/forgot/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func (s *ForgotTestSuite) TestHandle() {
Email: registered.Email.Value,
Username: registered.Username.Value,
},
&events.UserResetQueuedMeta{},
new(events.UserResetQueuedMeta),
))

for _, event := range registered.Events {
Expand Down
2 changes: 1 addition & 1 deletion pkg/context/user/domain/aggregate/user/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func New(raw *Primitive) (*User, error) {
Email: aggregate.Email.Value,
Username: aggregate.Username.Value,
},
&events.UserCreatedSucceededMeta{},
new(events.UserCreatedSucceededMeta),
))

return aggregate, nil
Expand Down

0 comments on commit c6e30c6

Please sign in to comment.