Skip to content

Commit d674a7b

Browse files
[azservicebus,azeventhubs] Cleanup, change interface{} to any (Azure#20481)
Fixes Azure#18406
1 parent b056f6d commit d674a7b

32 files changed

+147
-147
lines changed

sdk/messaging/azeventhubs/event_data_batch_unit_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) {
102102

103103
err = mb.AddEventData(&EventData{
104104
Body: []byte("small body"),
105-
Properties: map[string]interface{}{
105+
Properties: map[string]any{
106106
"small": "value",
107107
},
108108
}, nil)
@@ -123,7 +123,7 @@ func TestUnitEventDataBatchUnitTests(t *testing.T) {
123123

124124
err = mb.AddEventData(&EventData{
125125
Body: []byte("small body"),
126-
Properties: map[string]interface{}{
126+
Properties: map[string]any{
127127
"hello": "world",
128128
"anInt": 100,
129129
"aFLoat": 100.1,

sdk/messaging/azeventhubs/internal/amqpwrap/amqpwrap.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ type AMQPReceiver interface {
2424
ModifyMessage(ctx context.Context, msg *amqp.Message, options *amqp.ModifyMessageOptions) error
2525

2626
LinkName() string
27-
LinkSourceFilterValue(name string) interface{}
27+
LinkSourceFilterValue(name string) any
2828

2929
// wrapper only functions,
3030

@@ -193,7 +193,7 @@ func (rw *AMQPReceiverWrapper) LinkName() string {
193193
return rw.inner.LinkName()
194194
}
195195

196-
func (rw *AMQPReceiverWrapper) LinkSourceFilterValue(name string) interface{} {
196+
func (rw *AMQPReceiverWrapper) LinkSourceFilterValue(name string) any {
197197
return rw.inner.LinkSourceFilterValue(name)
198198
}
199199

sdk/messaging/azeventhubs/internal/cbs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func NegotiateClaim(ctx context.Context, audience string, conn amqpwrap.AMQPClie
7474

7575
msg := &amqp.Message{
7676
Value: token.Token,
77-
ApplicationProperties: map[string]interface{}{
77+
ApplicationProperties: map[string]any{
7878
cbsOperationKey: cbsOperationPutToken,
7979
cbsTokenTypeKey: string(token.TokenType),
8080
cbsAudienceKey: audience,

sdk/messaging/azeventhubs/internal/cbs_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestNegotiateClaimWithCloseTimeout(t *testing.T) {
3232
tp.EXPECT().GetToken(gomock.Any()).Return(&auth.Token{}, nil)
3333

3434
mock.SetupRPC(sender, receiver, 1, func(sent, response *amqp.Message) {
35-
response.ApplicationProperties = map[string]interface{}{
35+
response.ApplicationProperties = map[string]any{
3636
"status-code": int32(200),
3737
}
3838
})
@@ -85,7 +85,7 @@ func TestNegotiateClaimWithAuthFailure(t *testing.T) {
8585
mock.SetupRPC(sender, receiver, 1, func(sent, response *amqp.Message) {
8686
// this is the kind of error you get if your connection string is inconsistent
8787
// (ie, you tamper with the shared key, etc..)
88-
response.ApplicationProperties = map[string]interface{}{
88+
response.ApplicationProperties = map[string]any{
8989
"status-code": int32(401),
9090
"status-description": "InvalidSignature: The token has an invalid signature.",
9191
"error-condition": "com.microsoft:auth-failed",
@@ -117,7 +117,7 @@ func TestNegotiateClaimSuccess(t *testing.T) {
117117
receiver.EXPECT().Close(mock.NotCancelledAndHasTimeout)
118118

119119
mock.SetupRPC(sender, receiver, 1, func(sent, response *amqp.Message) {
120-
response.ApplicationProperties = map[string]interface{}{
120+
response.ApplicationProperties = map[string]any{
121121
"status-code": int32(200),
122122
}
123123
})

sdk/messaging/azeventhubs/internal/errors.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ type (
266266
ErrIncorrectType struct {
267267
Key string
268268
ExpectedType reflect.Type
269-
ActualValue interface{}
269+
ActualValue any
270270
}
271271

272272
// ErrAMQP indicates that the server communicated an AMQP error with a particular
@@ -295,7 +295,7 @@ func (e ErrMalformedMessage) Error() string {
295295

296296
// NewErrIncorrectType lets you skip using the `reflect` package. Just provide a variable of the desired type as
297297
// 'expected'.
298-
func NewErrIncorrectType(key string, expected, actual interface{}) ErrIncorrectType {
298+
func NewErrIncorrectType(key string, expected, actual any) ErrIncorrectType {
299299
return ErrIncorrectType{
300300
Key: key,
301301
ExpectedType: reflect.TypeOf(expected),

sdk/messaging/azeventhubs/internal/mock/mock_amqp.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/messaging/azeventhubs/internal/mock/mock_helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ type ContextCancelledMatcher struct {
7171
}
7272

7373
// Matches returns whether x is a match.
74-
func (m ContextCancelledMatcher) Matches(x interface{}) bool {
74+
func (m ContextCancelledMatcher) Matches(x any) bool {
7575
ctx := x.(context.Context)
7676

7777
if m.WantCancelled {
@@ -88,7 +88,7 @@ func (m ContextCancelledMatcher) String() string {
8888

8989
type ContextHasTestValueMatcher struct{}
9090

91-
func (m ContextHasTestValueMatcher) Matches(x interface{}) bool {
91+
func (m ContextHasTestValueMatcher) Matches(x any) bool {
9292
ctx := x.(context.Context)
9393
return ctx.Value(testContextKey(0)) == "correctContextWasUsed"
9494
}

sdk/messaging/azeventhubs/internal/namespace.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ func (ns *Namespace) newClientImpl(ctx context.Context) (amqpwrap.AMQPClient, er
157157
connOptions := amqp.ConnOptions{
158158
SASLType: amqp.SASLTypeAnonymous(),
159159
MaxSessions: 65535,
160-
Properties: map[string]interface{}{
160+
Properties: map[string]any{
161161
"product": "MSGolangClient",
162162
"version": Version,
163163
"platform": runtime.GOOS,

sdk/messaging/azeventhubs/internal/rpc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ func (l *rpcLink) RPC(ctx context.Context, msg *amqp.Message) (*amqpwrap.RPCResp
228228
msg.Properties.ReplyTo = &l.clientAddress
229229

230230
if msg.ApplicationProperties == nil {
231-
msg.ApplicationProperties = make(map[string]interface{})
231+
msg.ApplicationProperties = make(map[string]any)
232232
}
233233

234234
if _, ok := msg.ApplicationProperties["server-timeout"]; !ok {

sdk/messaging/azservicebus/admin/admin_client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ func (ac *Client) GetNamespaceProperties(ctx context.Context, options *GetNamesp
120120
return props, nil
121121
}
122122

123-
type pagerFunc func(ctx context.Context, pv interface{}) (*http.Response, error)
123+
type pagerFunc func(ctx context.Context, pv any) (*http.Response, error)
124124

125125
// newPagerFunc gets a function that can be used to page sequentially through an ATOM resource
126-
func (ac *Client) newPagerFunc(baseFragment string, maxPageSize int32, lenV func(pv interface{}) int) pagerFunc {
126+
func (ac *Client) newPagerFunc(baseFragment string, maxPageSize int32, lenV func(pv any) int) pagerFunc {
127127
eof := false
128128
skip := int32(0)
129129

130-
return func(ctx context.Context, pv interface{}) (*http.Response, error) {
130+
return func(ctx context.Context, pv any) (*http.Response, error) {
131131
if eof {
132132
return nil, nil
133133
}

0 commit comments

Comments
 (0)