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

Return an interface instead of a struct #159

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logger was not really being used in this function anywhere


if err := c.Validate(); err != nil {
return nil, nil, err
Expand Down
2 changes: 1 addition & 1 deletion 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 Down
Loading