Skip to content

Commit

Permalink
Remove unnecessary dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
ataleksandrov authored and FelisiaM committed Sep 24, 2019
1 parent bc6158e commit 970c084
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 20 deletions.
9 changes: 0 additions & 9 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 2 additions & 11 deletions middlewares/correlation_id_header.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"net/http"

"github.com/gofrs/uuid"
"github.com/pborman/uuid"
)

const CorrelationIDKey = "correlation-id"
Expand All @@ -26,19 +26,10 @@ func AddCorrelationIDToContext(next http.Handler) http.Handler {
}

if !found {
correlationID = generateCorrelationID()
correlationID = uuid.New()
}

newCtx := context.WithValue(req.Context(), CorrelationIDKey, correlationID)
next.ServeHTTP(w, req.WithContext(newCtx))
})
}

func generateCorrelationID() string {
uuids, err := uuid.NewV4()
if err != nil {
return ""
}

return uuids.String()
}

0 comments on commit 970c084

Please sign in to comment.