Skip to content

Commit a4e34a2

Browse files
Fix: return pointer from constructors (#15)
1 parent 62af25b commit a4e34a2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

pkg/modules/printer/printer.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package printer
33
import (
44
"context"
55
"fmt"
6+
67
"github.com/dipdup-net/indexer-sdk/pkg/modules"
78
)
89

@@ -17,10 +18,10 @@ const InputName = "input"
1718
var _ modules.Module = (*Printer)(nil)
1819

1920
// NewPrinter - constructor of printer structure
20-
func NewPrinter() Printer {
21+
func NewPrinter() *Printer {
2122
p := Printer{BaseModule: modules.New("printer")}
2223
p.CreateInput(InputName)
23-
return p
24+
return &p
2425
}
2526

2627
// Close - gracefully stops module

pkg/modules/stopper/stopper.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package stopper
22

33
import (
44
"context"
5+
56
"github.com/dipdup-net/indexer-sdk/pkg/modules"
67
"github.com/rs/zerolog/log"
78
)
@@ -24,14 +25,14 @@ const (
2425
InputName = "signal"
2526
)
2627

27-
func NewModule(cancelFunc context.CancelFunc) Module {
28+
func NewModule(cancelFunc context.CancelFunc) *Module {
2829
m := Module{
2930
BaseModule: modules.New("stopper"),
3031
stop: cancelFunc,
3132
}
3233
m.CreateInput(InputName)
3334

34-
return m
35+
return &m
3536
}
3637

3738
// Start -

0 commit comments

Comments
 (0)