Skip to content

Commit

Permalink
Return an interface instead of a struct
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Mar 1, 2024
1 parent 3cdf2c6 commit 9f210fc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions cmd/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ func stringsToMultiAddr(peers []string) []multiaddr.Multiaddr {
return res
}

func cliToOpts(c *cli.Context) ([]node.Option, []vpn.Option, *logger.Logger) {
func cliToOpts(c *cli.Context) ([]node.Option, []vpn.Option, *log.StandardLogger) {

var limitConfig *rcmgr.PartialLimitConfig

Expand Down Expand Up @@ -511,12 +511,12 @@ func cliToOpts(c *cli.Context) ([]node.Option, []vpn.Option, *logger.Logger) {
nc.Connection.PeerTable[dat[0]] = peer.ID(dat[1])
}

nodeOpts, vpnOpts, err := nc.ToOpts(llger)
nodeOpts, vpnOpts, err := nc.ToOpts()
if err != nil {
llger.Fatal(err.Error())
}

return nodeOpts, vpnOpts, llger
return nodeOpts, vpnOpts, &llger
}

func handleStopSignals() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func peers2AddrInfo(peers []string) []peer.AddrInfo {
var infiniteResourceLimits = rcmgr.InfiniteLimits.ToPartialLimitConfig().System

// ToOpts returns node and vpn options from a configuration
func (c Config) ToOpts(l *logger.Logger) ([]node.Option, []vpn.Option, error) {
func (c Config) ToOpts() ([]node.Option, []vpn.Option, error) {

if err := c.Validate(); err != nil {
return nil, nil, err
Expand Down
6 changes: 3 additions & 3 deletions pkg/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ type Logger struct {
zap *zap.SugaredLogger
}

func New(lvl log.LogLevel) *Logger {
func New(lvl log.LogLevel) log.StandardLogger {
cfg := zap.Config{

Encoding: "json",
Expand All @@ -53,8 +53,8 @@ func New(lvl log.LogLevel) *Logger {
defer logger.Sync()

sugar := logger.Sugar()

return &Logger{level: lvl, zap: sugar}
l := &Logger{level: lvl, zap: sugar}
return l
}

func joinMsg(args ...interface{}) (message string) {
Expand Down

0 comments on commit 9f210fc

Please sign in to comment.