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

patch: remove print statements from metadata & libparodus package #118

Merged
merged 1 commit into from
May 10, 2024
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
2 changes: 0 additions & 2 deletions internal/adapters/libparodus/libparodus.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package libparodus
import (
"context"
"errors"
"fmt"
"sync"
"time"

Expand Down Expand Up @@ -195,7 +194,6 @@ func (a *Adapter) receive(ctx context.Context) {

switch msg.Type {
case wrp.ServiceRegistrationMessageType:
fmt.Println("Registering service: ", msg.ServiceName)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I assumed we want to remove this print as well

a.register(ctx, msg)
case wrp.Invalid0MessageType,
wrp.Invalid1MessageType,
Expand Down
7 changes: 3 additions & 4 deletions internal/metadata/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func (c *MetadataProvider) GetMetadata() map[string]interface{} {
case InterfacesAvailable: // what if we can't get interfaces available?
names, err := c.networkService.GetInterfaceNames()
if err != nil {
fmt.Printf("unable to get network interfaces %s", err.Error())
// The err itself is ignored.
continue
}
header[field] = strings.Join(names, ",")
Expand All @@ -107,9 +107,8 @@ func (c *MetadataProvider) Decorate(headers http.Header) error {
header := c.GetMetadata()
headerBytes, err := json.Marshal(header)
if err != nil {
// use eventor to log
fmt.Printf("error marshaling convey header %s", err)
return err
// TODO use eventor to log
return fmt.Errorf("error marshaling convey header: %w", err)
}

headers.Set(HeaderName, string(headerBytes))
Expand Down
6 changes: 2 additions & 4 deletions internal/metadata/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ func NetworkServiceOpt(networkService net.NetworkServicer) Option {
return optionFunc(
func(c *MetadataProvider) error {
if networkService == nil {
fmt.Printf("nil networkService")
return ErrInvalidInput
return fmt.Errorf("%w: nil networkService", ErrInvalidInput)
}
c.networkService = networkService
return nil
Expand All @@ -39,8 +38,7 @@ func FieldsOpt(fields []string) Option {
}
}
if !valid {
fmt.Printf("invalid metadata field %s", field)
return ErrInvalidInput
return fmt.Errorf("%w: invalid metadata field", ErrInvalidInput)
}
}
c.fields = fields
Expand Down
Loading