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

chore: adding any function to context #580

Merged
merged 2 commits into from Aug 18, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions context.go
Expand Up @@ -379,6 +379,12 @@ func (c Context) Interface(key string, i interface{}) Context {
return c
}

// Any is a wrapper around Context.Interface.
func (c Context) Any(key string, i interface{}) Context {
c.l.context = enc.AppendInterface(enc.AppendKey(c.l.context, key), i)
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment is saying that this is a wrapper around Context.Interface but you copied its implementation and you are not calling into Context.Interface? I think you can just call into Context.Interface? Compiler will probably inline this anyway.

Copy link
Contributor Author

@shettyh shettyh Aug 18, 2023

Choose a reason for hiding this comment

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

Yes, fixed it

return c
}

type callerHook struct {
callerSkipFrameCount int
}
Expand Down