Skip to content

Commit 8867414

Browse files
committed
refactor: migrate to go1.26 pointer syntax
Signed-off-by: Bob Du <i@bobdu.cc>
1 parent 3d65f23 commit 8867414

File tree

9 files changed

+81
-82
lines changed

9 files changed

+81
-82
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
draft
2+
.cache/

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func main() {
3737
}
3838
client := kinesis.NewFromConfig(cfg)
3939
pr := producer.New(&producer.Config{
40-
StreamName: aws.String("test"),
40+
StreamName: new("test"),
4141
BacklogCount: 2000,
4242
Client: client,
4343
})
@@ -78,7 +78,7 @@ func main() {
7878
}),
7979
)
8080
pr := producer.New(&producer.Config{
81-
StreamName: aws.String("test"),
81+
StreamName: new("test"),
8282
BacklogCount: 2000,
8383
Client: client,
8484
Logger: logger,
@@ -98,7 +98,7 @@ import (
9898
logger := slog.New(sloglogrus.Option{Level: slog.LevelError, Logger: logrusLogger}.NewLogrusHandler())
9999

100100
pr := producer.New(&producer.Config{
101-
StreamName: aws.String("test"),
101+
StreamName: new("test"),
102102
BacklogCount: 2000,
103103
Client: client,
104104
Logger: logger,

aggregator.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import (
44
"bytes"
55
"crypto/md5"
66

7-
"github.com/aws/aws-sdk-go-v2/aws"
87
ktypes "github.com/aws/aws-sdk-go-v2/service/kinesis/types"
98
"google.golang.org/protobuf/encoding/protowire"
109
"google.golang.org/protobuf/proto"
@@ -115,7 +114,7 @@ func (a *Aggregator) Drain() (*ktypes.PutRecordsRequestEntry, error) {
115114

116115
entry := &ktypes.PutRecordsRequestEntry{
117116
Data: buffer.Bytes(),
118-
PartitionKey: aws.String(partitionKey),
117+
PartitionKey: new(partitionKey),
119118
}
120119
a.clear()
121120
return entry, nil

config_test.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@ package producer
22

33
import (
44
"testing"
5-
6-
"github.com/aws/aws-sdk-go-v2/aws"
75
)
86

97
func TestConfig_ValidStreamArn(t *testing.T) {
108
c := &Config{
11-
StreamARN: aws.String("arn:aws:kinesis:us-east-1:012345678901:stream/test-stream-name"),
9+
StreamARN: new("arn:aws:kinesis:us-east-1:012345678901:stream/test-stream-name"),
1210
}
1311
c.defaults()
1412
t.Logf("TestConfig_ValidStreamArn success")
1513
}
1614

1715
func TestConfig_InvalidStreamArn(t *testing.T) {
1816
c := &Config{
19-
StreamARN: aws.String("test-stream-name"),
17+
StreamARN: new("test-stream-name"),
2018
}
2119
defer func() {
2220
r := recover()
@@ -31,15 +29,15 @@ func TestConfig_InvalidStreamArn(t *testing.T) {
3129

3230
func TestConfig_ValidStreamName(t *testing.T) {
3331
c := &Config{
34-
StreamName: aws.String("test-stream-name"),
32+
StreamName: new("test-stream-name"),
3533
}
3634
c.defaults()
3735
t.Logf("TestConfig_ValidStreamName success")
3836
}
3937

4038
func TestConfig_InvalidStreamName(t *testing.T) {
4139
c := &Config{
42-
StreamName: aws.String("test`-stream/name"),
40+
StreamName: new("test`-stream/name"),
4341
}
4442
defer func() {
4543
r := recover()
@@ -54,8 +52,8 @@ func TestConfig_InvalidStreamName(t *testing.T) {
5452

5553
func TestConfig_BothStreamArnAndName(t *testing.T) {
5654
c := &Config{
57-
StreamARN: aws.String("arn:aws:kinesis:us-east-1:012345678901:stream/test-stream-name"),
58-
StreamName: aws.String("test-stream-name"),
55+
StreamARN: new("arn:aws:kinesis:us-east-1:012345678901:stream/test-stream-name"),
56+
StreamName: new("test-stream-name"),
5957
}
6058
c.defaults()
6159
t.Logf("TestConfig_BothStreamArnAndName success")
@@ -76,8 +74,8 @@ func TestConfig_EmptyStreamArnAndName(t *testing.T) {
7674

7775
func TestConfig_NoMatchStreamArnAndName(t *testing.T) {
7876
c := &Config{
79-
StreamARN: aws.String("arn:aws:kinesis:us-east-1:012345678901:stream/test-stream-name"),
80-
StreamName: aws.String("test-stream-name-2"),
77+
StreamARN: new("arn:aws:kinesis:us-east-1:012345678901:stream/test-stream-name"),
78+
StreamName: new("test-stream-name-2"),
8179
}
8280
defer func() {
8381
r := recover()

example_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"testing"
1010
"time"
1111

12-
"github.com/aws/aws-sdk-go-v2/aws"
1312
"github.com/aws/aws-sdk-go-v2/config"
1413
"github.com/aws/aws-sdk-go-v2/service/kinesis"
1514
"github.com/go-faker/faker/v4"
@@ -28,7 +27,7 @@ func TestExample(t *testing.T) {
2827
cfg, _ := config.LoadDefaultConfig(context.TODO())
2928
client := kinesis.NewFromConfig(cfg)
3029
pr := New(&Config{
31-
StreamName: aws.String("test"),
30+
StreamName: new("test"),
3231
BacklogCount: 2000,
3332
Client: client,
3433
Logger: logger,

go.mod

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,34 @@
11
module github.com/kinesis-producer-go/kinesis-producer
22

3-
go 1.24.0
3+
go 1.26.0
44

55
require (
6-
github.com/aws/aws-sdk-go-v2 v1.39.6
7-
github.com/aws/aws-sdk-go-v2/config v1.31.17
8-
github.com/aws/aws-sdk-go-v2/service/kinesis v1.42.1
6+
github.com/aws/aws-sdk-go-v2 v1.41.2
7+
github.com/aws/aws-sdk-go-v2/config v1.32.10
8+
github.com/aws/aws-sdk-go-v2/service/kinesis v1.43.1
99
github.com/go-faker/faker/v4 v4.7.0
1010
github.com/jpillora/backoff v1.0.0
1111
github.com/stretchr/testify v1.11.1
12-
golang.org/x/sync v0.17.0
13-
google.golang.org/protobuf v1.36.10
12+
golang.org/x/sync v0.19.0
13+
google.golang.org/protobuf v1.36.11
1414
)
1515

1616
require (
17-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 // indirect
18-
github.com/aws/aws-sdk-go-v2/credentials v1.18.21 // indirect
19-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 // indirect
20-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 // indirect
21-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 // indirect
17+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect
18+
github.com/aws/aws-sdk-go-v2/credentials v1.19.10 // indirect
19+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 // indirect
20+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 // indirect
21+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 // indirect
2222
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect
23-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 // indirect
24-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 // indirect
25-
github.com/aws/aws-sdk-go-v2/service/sso v1.30.1 // indirect
26-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5 // indirect
27-
github.com/aws/aws-sdk-go-v2/service/sts v1.39.1 // indirect
28-
github.com/aws/smithy-go v1.23.2 // indirect
23+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 // indirect
24+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 // indirect
25+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 // indirect
26+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 // indirect
27+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 // indirect
28+
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 // indirect
29+
github.com/aws/smithy-go v1.24.1 // indirect
2930
github.com/davecgh/go-spew v1.1.1 // indirect
3031
github.com/pmezard/go-difflib v1.0.0 // indirect
31-
golang.org/x/text v0.30.0 // indirect
32+
golang.org/x/text v0.34.0 // indirect
3233
gopkg.in/yaml.v3 v3.0.1 // indirect
3334
)

go.sum

Lines changed: 36 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
1-
github.com/aws/aws-sdk-go-v2 v1.39.6 h1:2JrPCVgWJm7bm83BDwY5z8ietmeJUbh3O2ACnn+Xsqk=
2-
github.com/aws/aws-sdk-go-v2 v1.39.6/go.mod h1:c9pm7VwuW0UPxAEYGyTmyurVcNrbF6Rt/wixFqDhcjE=
3-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3 h1:DHctwEM8P8iTXFxC/QK0MRjwEpWQeM9yzidCRjldUz0=
4-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.3/go.mod h1:xdCzcZEtnSTKVDOmUZs4l/j3pSV6rpo1WXl5ugNsL8Y=
5-
github.com/aws/aws-sdk-go-v2/config v1.31.17 h1:QFl8lL6RgakNK86vusim14P2k8BFSxjvUkcWLDjgz9Y=
6-
github.com/aws/aws-sdk-go-v2/config v1.31.17/go.mod h1:V8P7ILjp/Uef/aX8TjGk6OHZN6IKPM5YW6S78QnRD5c=
7-
github.com/aws/aws-sdk-go-v2/credentials v1.18.21 h1:56HGpsgnmD+2/KpG0ikvvR8+3v3COCwaF4r+oWwOeNA=
8-
github.com/aws/aws-sdk-go-v2/credentials v1.18.21/go.mod h1:3YELwedmQbw7cXNaII2Wywd+YY58AmLPwX4LzARgmmA=
9-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13 h1:T1brd5dR3/fzNFAQch/iBKeX07/ffu/cLu+q+RuzEWk=
10-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.13/go.mod h1:Peg/GBAQ6JDt+RoBf4meB1wylmAipb7Kg2ZFakZTlwk=
11-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13 h1:a+8/MLcWlIxo1lF9xaGt3J/u3yOZx+CdSveSNwjhD40=
12-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.13/go.mod h1:oGnKwIYZ4XttyU2JWxFrwvhF6YKiK/9/wmE3v3Iu9K8=
13-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13 h1:HBSI2kDkMdWz4ZM7FjwE7e/pWDEZ+nR95x8Ztet1ooY=
14-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.13/go.mod h1:YE94ZoDArI7awZqJzBAZ3PDD2zSfuP7w6P2knOzIn8M=
1+
github.com/aws/aws-sdk-go-v2 v1.41.2 h1:LuT2rzqNQsauaGkPK/7813XxcZ3o3yePY0Iy891T2ls=
2+
github.com/aws/aws-sdk-go-v2 v1.41.2/go.mod h1:IvvlAZQXvTXznUPfRVfryiG1fbzE2NGK6m9u39YQ+S4=
3+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q=
4+
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c=
5+
github.com/aws/aws-sdk-go-v2/config v1.32.10 h1:9DMthfO6XWZYLfzZglAgW5Fyou2nRI5CuV44sTedKBI=
6+
github.com/aws/aws-sdk-go-v2/config v1.32.10/go.mod h1:2rUIOnA2JaiqYmSKYmRJlcMWy6qTj1vuRFscppSBMcw=
7+
github.com/aws/aws-sdk-go-v2/credentials v1.19.10 h1:EEhmEUFCE1Yhl7vDhNOI5OCL/iKMdkkYFTRpZXNw7m8=
8+
github.com/aws/aws-sdk-go-v2/credentials v1.19.10/go.mod h1:RnnlFCAlxQCkN2Q379B67USkBMu1PipEEiibzYN5UTE=
9+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18 h1:Ii4s+Sq3yDfaMLpjrJsqD6SmG/Wq/P5L/hw2qa78UAY=
10+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.18/go.mod h1:6x81qnY++ovptLE6nWQeWrpXxbnlIex+4H4eYYGcqfc=
11+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18 h1:F43zk1vemYIqPAwhjTjYIz0irU2EY7sOb/F5eJ3HuyM=
12+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.18/go.mod h1:w1jdlZXrGKaJcNoL+Nnrj+k5wlpGXqnNrKoP22HvAug=
13+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18 h1:xCeWVjj0ki0l3nruoyP2slHsGArMxeiiaoPN5QZH6YQ=
14+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.18/go.mod h1:r/eLGuGCBw6l36ZRWiw6PaZwPXb6YOj+i/7MizNl5/k=
1515
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk=
1616
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc=
17-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3 h1:x2Ibm/Af8Fi+BH+Hsn9TXGdT+hKbDd5XOTZxTMxDk7o=
18-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.3/go.mod h1:IW1jwyrQgMdhisceG8fQLmQIydcT/jWY21rFhzgaKwo=
19-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13 h1:kDqdFvMY4AtKoACfzIGD8A0+hbT41KTKF//gq7jITfM=
20-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.13/go.mod h1:lmKuogqSU3HzQCwZ9ZtcqOc5XGMqtDK7OIc2+DxiUEg=
21-
github.com/aws/aws-sdk-go-v2/service/kinesis v1.42.1 h1:dSwPbGWGhA37laPvoToLp1b1wHRKUuPMorKCL/E+pi8=
22-
github.com/aws/aws-sdk-go-v2/service/kinesis v1.42.1/go.mod h1:jTDNZao/9uv/6JeaeDWEqA4s+l6c8+cqaDeYFpM+818=
23-
github.com/aws/aws-sdk-go-v2/service/sso v1.30.1 h1:0JPwLz1J+5lEOfy/g0SURC9cxhbQ1lIMHMa+AHZSzz0=
24-
github.com/aws/aws-sdk-go-v2/service/sso v1.30.1/go.mod h1:fKvyjJcz63iL/ftA6RaM8sRCtN4r4zl4tjL3qw5ec7k=
25-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5 h1:OWs0/j2UYR5LOGi88sD5/lhN6TDLG6SfA7CqsQO9zF0=
26-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.5/go.mod h1:klO+ejMvYsB4QATfEOIXk8WAEwN4N0aBfJpvC+5SZBo=
27-
github.com/aws/aws-sdk-go-v2/service/sts v1.39.1 h1:mLlUgHn02ue8whiR4BmxxGJLR2gwU6s6ZzJ5wDamBUs=
28-
github.com/aws/aws-sdk-go-v2/service/sts v1.39.1/go.mod h1:E19xDjpzPZC7LS2knI9E6BaRFDK43Eul7vd6rSq2HWk=
29-
github.com/aws/smithy-go v1.23.2 h1:Crv0eatJUQhaManss33hS5r40CG3ZFH+21XSkqMrIUM=
30-
github.com/aws/smithy-go v1.23.2/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
17+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5 h1:CeY9LUdur+Dxoeldqoun6y4WtJ3RQtzk0JMP2gfUay0=
18+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.5/go.mod h1:AZLZf2fMaahW5s/wMRciu1sYbdsikT/UHwbUjOdEVTc=
19+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18 h1:LTRCYFlnnKFlKsyIQxKhJuDuA3ZkrDQMRYm6rXiHlLY=
20+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.18/go.mod h1:XhwkgGG6bHSd00nO/mexWTcTjgd6PjuvWQMqSn2UaEk=
21+
github.com/aws/aws-sdk-go-v2/service/kinesis v1.43.1 h1:rnQBqK+aD4aXVYd8TKvsVyW7I8ftYoCkghx+Oy2SbKM=
22+
github.com/aws/aws-sdk-go-v2/service/kinesis v1.43.1/go.mod h1:umzl/XlRWxeiDQbFMXVFXQZsWMDJE5XLkNnMRTGaOmc=
23+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6 h1:MzORe+J94I+hYu2a6XmV5yC9huoTv8NRcCrUNedDypQ=
24+
github.com/aws/aws-sdk-go-v2/service/signin v1.0.6/go.mod h1:hXzcHLARD7GeWnifd8j9RWqtfIgxj4/cAtIVIK7hg8g=
25+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11 h1:7oGD8KPfBOJGXiCoRKrrrQkbvCp8N++u36hrLMPey6o=
26+
github.com/aws/aws-sdk-go-v2/service/sso v1.30.11/go.mod h1:0DO9B5EUJQlIDif+XJRWCljZRKsAFKh3gpFz7UnDtOo=
27+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15 h1:edCcNp9eGIUDUCrzoCu1jWAXLGFIizeqkdkKgRlJwWc=
28+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.15/go.mod h1:lyRQKED9xWfgkYC/wmmYfv7iVIM68Z5OQ88ZdcV1QbU=
29+
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7 h1:NITQpgo9A5NrDZ57uOWj+abvXSb83BbyggcUBVksN7c=
30+
github.com/aws/aws-sdk-go-v2/service/sts v1.41.7/go.mod h1:sks5UWBhEuWYDPdwlnRFn1w7xWdH29Jcpe+/PJQefEs=
31+
github.com/aws/smithy-go v1.24.1 h1:VbyeNfmYkWoxMVpGUAbQumkODcYmfMRfZ8yQiH30SK0=
32+
github.com/aws/smithy-go v1.24.1/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0=
3133
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3234
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3335
github.com/go-faker/faker/v4 v4.7.0 h1:VboC02cXHl/NuQh5lM2W8b87yp4iFXIu59x4w0RZi4E=
@@ -40,12 +42,12 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
4042
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4143
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
4244
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
43-
golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug=
44-
golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
45-
golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k=
46-
golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM=
47-
google.golang.org/protobuf v1.36.10 h1:AYd7cD/uASjIL6Q9LiTjz8JLcrh/88q5UObnmY3aOOE=
48-
google.golang.org/protobuf v1.36.10/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
45+
golang.org/x/sync v0.19.0 h1:vV+1eWNmZ5geRlYjzm2adRgW2/mcpevXNg50YZtPCE4=
46+
golang.org/x/sync v0.19.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI=
47+
golang.org/x/text v0.34.0 h1:oL/Qq0Kdaqxa1KbNeMKwQq0reLCCaFtqu2eNuSeNHbk=
48+
golang.org/x/text v0.34.0/go.mod h1:homfLqTYRFyVYemLBFl5GgL/DWEiH5wcsQ5gSh1yziA=
49+
google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE=
50+
google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco=
4951
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
5052
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
5153
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=

producer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ func (p *Producer) Put(data []byte) error {
7777
if len(data) > p.AggregateBatchSize {
7878
p.records <- &ktypes.PutRecordsRequestEntry{
7979
Data: data,
80-
PartitionKey: aws.String(RandPartitionKey()),
80+
PartitionKey: new(RandPartitionKey()),
8181
}
8282
return nil
8383
}

producer_test.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"sync"
77
"testing"
88

9-
"github.com/aws/aws-sdk-go-v2/aws"
109
k "github.com/aws/aws-sdk-go-v2/service/kinesis"
1110
ktypes "github.com/aws/aws-sdk-go-v2/service/kinesis/types"
1211
)
@@ -63,7 +62,7 @@ var testCases = []testCase{
6362
{
6463
Error: nil,
6564
Response: &k.PutRecordsOutput{
66-
FailedRecordCount: aws.Int32(0),
65+
FailedRecordCount: new(int32(0)),
6766
},
6867
},
6968
}},
@@ -81,13 +80,13 @@ var testCases = []testCase{
8180
{
8281
Error: nil,
8382
Response: &k.PutRecordsOutput{
84-
FailedRecordCount: aws.Int32(0),
83+
FailedRecordCount: new(int32(0)),
8584
},
8685
},
8786
{
8887
Error: nil,
8988
Response: &k.PutRecordsOutput{
90-
FailedRecordCount: aws.Int32(0),
89+
FailedRecordCount: new(int32(0)),
9190
},
9291
},
9392
}},
@@ -106,17 +105,17 @@ var testCases = []testCase{
106105
{
107106
Error: nil,
108107
Response: &k.PutRecordsOutput{
109-
FailedRecordCount: aws.Int32(1),
108+
FailedRecordCount: new(int32(1)),
110109
Records: []ktypes.PutRecordsResultEntry{
111-
{SequenceNumber: aws.String("3"), ShardId: aws.String("1")},
112-
{ErrorCode: aws.String("400")},
110+
{SequenceNumber: new("3"), ShardId: new("1")},
111+
{ErrorCode: new("400")},
113112
},
114113
},
115114
},
116115
{
117116
Error: nil,
118117
Response: &k.PutRecordsOutput{
119-
FailedRecordCount: aws.Int32(0),
118+
FailedRecordCount: new(int32(0)),
120119
},
121120
},
122121
}},
@@ -135,13 +134,13 @@ var testCases = []testCase{
135134
{
136135
Error: nil,
137136
Response: &k.PutRecordsOutput{
138-
FailedRecordCount: aws.Int32(0),
137+
FailedRecordCount: new(int32(0)),
139138
},
140139
},
141140
{
142141
Error: nil,
143142
Response: &k.PutRecordsOutput{
144-
FailedRecordCount: aws.Int32(0),
143+
FailedRecordCount: new(int32(0)),
145144
},
146145
},
147146
}},
@@ -154,7 +153,7 @@ var testCases = []testCase{
154153

155154
func TestProducer(t *testing.T) {
156155
for _, test := range testCases {
157-
test.config.StreamName = aws.String("foo")
156+
test.config.StreamName = new("foo")
158157
test.config.MaxConnections = 1
159158
test.config.Client = test.putter
160159
p := New(test.config)
@@ -181,7 +180,7 @@ func TestProducer(t *testing.T) {
181180
func TestNotify(t *testing.T) {
182181
kError := errors.New("ResourceNotFoundException: Stream foo under account X not found")
183182
p := New(&Config{
184-
StreamName: aws.String("foo"),
183+
StreamName: new("foo"),
185184
MaxConnections: 1,
186185
BatchCount: 1,
187186
AggregateBatchCount: 10,

0 commit comments

Comments
 (0)