Procyon version
current main branch
Go version
go1.24
What did you do?
Used WithQualifierFor[T] on a constructor that has multiple parameters with the same type.
func NewService(primary *Client, replica *Client) *Service {
return &Service{
primary: primary,
replica: replica,
}
}
component.Register(
NewService,
component.WithQualifierFor[*Client]("primaryClient"),
)
What did you see happen?
The qualifier is applied to every constructor argument matching the given type.
In this case, both primary and replica receive the primaryClient qualifier.
What did you expect to see?
WithQualifierFor[T] should not silently apply the same qualifier to multiple constructor arguments of the same type.
If more than one constructor argument matches type T, registration should fail with a clear error, because the qualifier target is ambiguous.
Additional context
A separate option such as WithQualifierAt(index, name) can be used for constructors that need different qualifiers for multiple arguments of the same type.
Procyon version
current main branch
Go version
go1.24
What did you do?
Used WithQualifierFor[T] on a constructor that has multiple parameters with the same type.
What did you see happen?
The qualifier is applied to every constructor argument matching the given type.
In this case, both primary and replica receive the primaryClient qualifier.
What did you expect to see?
WithQualifierFor[T] should not silently apply the same qualifier to multiple constructor arguments of the same type.
If more than one constructor argument matches type T, registration should fail with a clear error, because the qualifier target is ambiguous.
Additional context
A separate option such as WithQualifierAt(index, name) can be used for constructors that need different qualifiers for multiple arguments of the same type.