diff --git a/http/jsonapi/request.go b/http/jsonapi/request.go index 37c7189e9..5e2eff67b 100644 --- a/http/jsonapi/request.go +++ b/http/jsonapi/request.go @@ -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() diff --git a/http/middleware/external_dependency.go b/http/middleware/external_dependency.go index 2b039ac37..d8728f369 100644 --- a/http/middleware/external_dependency.go +++ b/http/middleware/external_dependency.go @@ -4,7 +4,6 @@ package middleware import ( - "bytes" "context" "fmt" "net/http" @@ -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 @@ -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