Skip to content

fix: change User and Tenant param type to ...any#36

Open
cley44 wants to merge 1 commit intosamber:mainfrom
cley44:fix-user-tenant-wrong-type
Open

fix: change User and Tenant param type to ...any#36
cley44 wants to merge 1 commit intosamber:mainfrom
cley44:fix-user-tenant-wrong-type

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.

@cley44 cley44 force-pushed the fix-user-tenant-wrong-type branch from 5ad28fb to 463623e Compare March 14, 2026 18:49
@cley44 cley44 force-pushed the fix-user-tenant-wrong-type branch from 463623e to a0a1027 Compare March 14, 2026 18:51
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