Skip to content

Commit d4aabde

Browse files
committed
Linter fixes
Signed-off-by: Tiago Scolari <[email protected]>
1 parent 441e348 commit d4aabde

File tree

4 files changed

+14
-13
lines changed

4 files changed

+14
-13
lines changed

client/crypto.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ func performCryptoOperation[T runtimev1pb.DecryptRequest | runtimev1pb.EncryptRe
9393
reqProto *T,
9494
resProto *Y,
9595
) (io.Reader, error) {
96-
9796
var err error
9897
// Pipe for writing the response
9998
pr, pw := io.Pipe()

client/crypto_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,9 @@ func hasOptions[T runtimev1pb.DecryptRequest | runtimev1pb.EncryptRequest](msg *
297297

298298
switch r := any(msg).(type) {
299299
case *runtimev1pb.EncryptRequest:
300-
return r.Options != nil
300+
return r.GetOptions() != nil
301301
case *runtimev1pb.DecryptRequest:
302-
return r.Options != nil
302+
return r.GetOptions() != nil
303303
}
304304

305305
return false

client/internal/crypto/helpers.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package crypto
22

33
import (
4+
"google.golang.org/protobuf/proto"
5+
46
commonv1pb "github.com/dapr/go-sdk/internal/proto/dapr/proto/common/v1"
57
runtimev1 "github.com/dapr/go-sdk/internal/proto/dapr/proto/runtime/v1"
6-
"google.golang.org/protobuf/proto"
78
)
89

910
func GetPayload[T runtimev1.DecryptRequest | runtimev1.EncryptRequest | runtimev1.DecryptResponse | runtimev1.EncryptResponse](req *T) *commonv1pb.StreamPayload {
@@ -13,13 +14,13 @@ func GetPayload[T runtimev1.DecryptRequest | runtimev1.EncryptRequest | runtimev
1314

1415
switch r := any(req).(type) {
1516
case *runtimev1.EncryptRequest:
16-
return r.Payload
17+
return r.GetPayload()
1718
case *runtimev1.DecryptRequest:
18-
return r.Payload
19+
return r.GetPayload()
1920
case *runtimev1.EncryptResponse:
20-
return r.Payload
21+
return r.GetPayload()
2122
case *runtimev1.DecryptResponse:
22-
return r.Payload
23+
return r.GetPayload()
2324
}
2425

2526
return nil

client/internal/crypto/helpers_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ import (
44
"testing"
55

66
"github.com/dapr/go-sdk/client/internal/crypto"
7-
commonv1 "github.com/dapr/go-sdk/internal/proto/dapr/proto/common/v1"
8-
runtimev1 "github.com/dapr/go-sdk/internal/proto/dapr/proto/runtime/v1"
97
"github.com/stretchr/testify/assert"
108
"github.com/stretchr/testify/require"
119
"google.golang.org/protobuf/proto"
10+
11+
commonv1 "github.com/dapr/go-sdk/internal/proto/dapr/proto/common/v1"
12+
runtimev1 "github.com/dapr/go-sdk/internal/proto/dapr/proto/runtime/v1"
1213
)
1314

1415
func TestPayloadMethods(t *testing.T) {
@@ -56,7 +57,7 @@ func TestPayloadMethods(t *testing.T) {
5657
require.Failf(t, "unsupported proto message type", "the type was %T", r)
5758
}
5859

59-
assert.Equal(t, tc.inputData, outputPayload.Data, "payload should match the input")
60+
assert.Equal(t, tc.inputData, outputPayload.GetData(), "payload should match the input")
6061
})
6162
}
6263
}
@@ -87,10 +88,10 @@ func TestSetOptions(t *testing.T) {
8788
switch r := tc.protoMsg.(type) {
8889
case *runtimev1.EncryptRequest:
8990
crypto.SetOptions(r, tc.options)
90-
outputOptions = r.Options
91+
outputOptions = r.GetOptions()
9192
case *runtimev1.DecryptRequest:
9293
crypto.SetOptions(r, tc.options)
93-
outputOptions = r.Options
94+
outputOptions = r.GetOptions()
9495
default:
9596
require.Failf(t, "unsupported proto message type", "the type was %T", r)
9697
}

0 commit comments

Comments
 (0)