Skip to content

Commit 209323b

Browse files
committed
gofmt + dep
1 parent 8b0b350 commit 209323b

File tree

4 files changed

+93
-14
lines changed

4 files changed

+93
-14
lines changed

.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ _testmain.go
2222
*.exe
2323
*.test
2424
*.prof
25+
26+
vendor/

Gopkg.lock

+45
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Gopkg.toml example
2+
#
3+
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
4+
# for detailed Gopkg.toml documentation.
5+
#
6+
# required = ["github.com/user/thing/cmd/thing"]
7+
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
8+
#
9+
# [[constraint]]
10+
# name = "github.com/user/project"
11+
# version = "1.0.0"
12+
#
13+
# [[constraint]]
14+
# name = "github.com/user/project2"
15+
# branch = "dev"
16+
# source = "github.com/myfork/project2"
17+
#
18+
# [[override]]
19+
# name = "github.com/x/y"
20+
# version = "2.4.0"
21+
#
22+
# [prune]
23+
# non-go = false
24+
# go-tests = true
25+
# unused-packages = true
26+
27+
28+
[[constraint]]
29+
name = "github.com/aws/aws-sdk-go"
30+
version = "1.15.4"
31+
32+
[prune]
33+
go-tests = true
34+
unused-packages = true

stream/stream.go

+12-14
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
// Yury Kozyrev (urakozz)
32
// MIT License
43
package stream
@@ -23,9 +22,9 @@ type StreamSubscriber struct {
2322
}
2423

2524
func NewStreamSubscriber(
26-
dynamoSvc *dynamodb.DynamoDB,
27-
streamSvc *dynamodbstreams.DynamoDBStreams,
28-
table string) *StreamSubscriber {
25+
dynamoSvc *dynamodb.DynamoDB,
26+
streamSvc *dynamodbstreams.DynamoDBStreams,
27+
table string) *StreamSubscriber {
2928
s := &StreamSubscriber{dynamoSvc: dynamoSvc, streamSvc: streamSvc, table: &table}
3029
s.applyDefaults()
3130
return s
@@ -50,7 +49,7 @@ func (r *StreamSubscriber) GetStreamData() (<-chan *dynamodbstreams.Record, <-ch
5049
ch := make(chan *dynamodbstreams.Record, 1)
5150
errCh := make(chan error, 1)
5251

53-
go func(ch chan <- *dynamodbstreams.Record, errCh chan <- error) {
52+
go func(ch chan<- *dynamodbstreams.Record, errCh chan<- error) {
5453
var shardId *string
5554
var prevShardId *string
5655
var streamArn *string
@@ -89,7 +88,7 @@ func (r *StreamSubscriber) GetStreamDataAsync() (<-chan *dynamodbstreams.Record,
8988
needUpdateChannel <- struct{}{}
9089

9190
allShards := make(map[string]struct{})
92-
shardProcessingLimit := 5;
91+
shardProcessingLimit := 5
9392
shardsCh := make(chan *dynamodbstreams.GetShardIteratorInput, shardProcessingLimit)
9493
lock := sync.Mutex{}
9594

@@ -112,7 +111,7 @@ func (r *StreamSubscriber) GetStreamDataAsync() (<-chan *dynamodbstreams.Record,
112111
errCh <- err
113112
return
114113
}
115-
ids, err := r.getShardIds(streamArn);
114+
ids, err := r.getShardIds(streamArn)
116115
if err != nil {
117116
errCh <- err
118117
return
@@ -137,17 +136,17 @@ func (r *StreamSubscriber) GetStreamDataAsync() (<-chan *dynamodbstreams.Record,
137136

138137
limit := make(chan struct{}, shardProcessingLimit)
139138

140-
go func(){
139+
go func() {
141140
time.Sleep(time.Second * 10)
142141
for shardInput := range shardsCh {
143142
limit <- struct{}{}
144-
go func(sInput *dynamodbstreams.GetShardIteratorInput){
143+
go func(sInput *dynamodbstreams.GetShardIteratorInput) {
145144
err := r.processShard(sInput, ch)
146145
if err != nil {
147146
errCh <- err
148147
}
149148
// TODO: think about cleaning list of shards: delete(allShards, *sInput.ShardId)
150-
<- limit
149+
<-limit
151150
}(shardInput)
152151
}
153152
}()
@@ -211,15 +210,15 @@ func (r *StreamSubscriber) getLatestStreamArn() (*string, error) {
211210
return tableInfo.Table.LatestStreamArn, nil
212211
}
213212

214-
func (r *StreamSubscriber) processShardBackport(shardId, lastStreamArn *string, ch chan <- *dynamodbstreams.Record) error {
213+
func (r *StreamSubscriber) processShardBackport(shardId, lastStreamArn *string, ch chan<- *dynamodbstreams.Record) error {
215214
return r.processShard(&dynamodbstreams.GetShardIteratorInput{
216215
StreamArn: lastStreamArn,
217216
ShardId: shardId,
218217
ShardIteratorType: r.ShardIteratorType,
219-
}, ch);
218+
}, ch)
220219
}
221220

222-
func (r *StreamSubscriber) processShard(input *dynamodbstreams.GetShardIteratorInput, ch chan <- *dynamodbstreams.Record) error {
221+
func (r *StreamSubscriber) processShard(input *dynamodbstreams.GetShardIteratorInput, ch chan<- *dynamodbstreams.Record) error {
223222
iter, err := r.streamSvc.GetShardIterator(input)
224223
if err != nil {
225224
return err
@@ -264,4 +263,3 @@ func (r *StreamSubscriber) processShard(input *dynamodbstreams.GetShardIteratorI
264263
}
265264
return nil
266265
}
267-

0 commit comments

Comments
 (0)