Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Landgraf committed Dec 15, 2020
1 parent 68414d9 commit 851e1a0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions http/jsonapi/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ func unmarshalNode(data *Node, model reflect.Value, included *map[string]*Node)

buf := bytes.NewBuffer(nil)

err = json.NewEncoder(buf).Encode(data.Relationships[args[1]]) // nolint: errcheck
json.NewDecoder(buf).Decode(relationship) // nolint: errcheck
json.NewEncoder(buf).Encode(data.Relationships[args[1]]) // nolint: errcheck
json.NewDecoder(buf).Decode(relationship) // nolint: errcheck

data := relationship.Data
models := reflect.New(fieldValue.Type()).Elem()
Expand Down
11 changes: 5 additions & 6 deletions http/middleware/external_dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
package middleware

import (
"bytes"
"context"
"fmt"
"net/http"
Expand Down Expand Up @@ -83,7 +82,7 @@ func ExternalDependencyContextFromContext(ctx context.Context) *ExternalDependen
return nil
}

// ExternalDependencyContext contains all dependencies that where seed
// ExternalDependencyContext contains all dependencies that were seen
// during the request livecycle
type ExternalDependencyContext struct {
mu sync.RWMutex
Expand All @@ -101,16 +100,16 @@ func (c *ExternalDependencyContext) AddDependency(name string, duration time.Dur

// String formats all external dependencies
func (c *ExternalDependencyContext) String() string {
var buf bytes.Buffer
var b strings.Builder
sep := len(c.dependencies) - 1
for _, dep := range c.dependencies {
buf.WriteString(dep.String())
b.WriteString(dep.String())
if sep > 0 {
buf.WriteByte(',')
b.WriteByte(',')
sep--
}
}
return buf.String()
return b.String()
}

// Parse a external dependency value
Expand Down

0 comments on commit 851e1a0

Please sign in to comment.