Skip to content

Conversation

cley44
Copy link

@cley44 cley44 commented Nov 25, 2024

Hey 👋,

oops.User() only accept map[string]any as second argument but the underlying function is expecting ...any (chain of key/value)

This is the same for oops.Tenant()

This result in this code working

oops.Hint("test").User("userID", "firstname", "John")

But this code does not

// Too many arguments in call to 'oops.User'
oops.User("userID", "firstname", "John")
// Is accepted but doesn't add firstname to user
oops.User("userID", map[string]any{
	"firstname": "John"
})

@samber
Copy link
Owner

samber commented Feb 23, 2025

Warning: it might cause a breaking change.

I suggest 3 interpretations of the parameters:

  • oops.User(userID, slog.Attr...)
  • oops.User(userID, key string1, value1 any, key2 string, value2 any...)
  • oops.User(userID, kv map[string]any....)

Please check the implem of slog.Group or slog.With, which is similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants