Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't use pointer to interface #465

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions pkg/api/payer/publish_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,15 @@ func buildPayerService(
mockMessagePublisher := blockchainMocks.NewMockIBlockchainPublisher(t)

metaMocks := metadataMocks.NewMockMetadataApiClient(t)
metadataConstructor := &FixedMetadataApiClientConstructor{
mockClient: metaMocks,
}
var interf payer.MetadataApiClientConstructor = metadataConstructor
payerService, err := payer.NewPayerApiService(
ctx,
log,
mockRegistry,
privKey,
mockMessagePublisher,
&interf,
&FixedMetadataApiClientConstructor{
mockClient: metaMocks,
},
)
require.NoError(t, err)

Expand Down
4 changes: 2 additions & 2 deletions pkg/api/payer/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ func NewPayerApiService(
registry registry.NodeRegistry,
payerPrivateKey *ecdsa.PrivateKey,
blockchainPublisher blockchain.IBlockchainPublisher,
metadataApiClient *MetadataApiClientConstructor,
metadataApiClient MetadataApiClientConstructor,
) (*Service, error) {
var metadataClient MetadataApiClientConstructor
clientManager := NewClientManager(log, registry)
if metadataApiClient == nil {
metadataClient = &DefaultMetadataApiClientConstructor{clientManager: clientManager}
} else {
metadataClient = *metadataApiClient
metadataClient = metadataApiClient
}
return &Service{
ctx: ctx,
Expand Down
Loading