Skip to content

Commit 44d5f64

Browse files
authored
Merge branch 'master' into remove-dialog-action-from-lex-event
2 parents 9423473 + d89e42d commit 44d5f64

27 files changed

+134
-12
lines changed

.travis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ before_script:
2727
- LINT_PKGS=$(go list ./... | grep -Ev 'aws-lambda-go/lambda')
2828

2929
script:
30-
- diff -u <(echo -n) <(gofmt -d ./) # Fail if a .go file hasn't been formatted with gofmt
31-
- goverage -v -covermode=atomic -coverprofile=coverage.txt $PKGS # Run all tests with coverage
32-
- go vet -v ./... # static analyisis
33-
- golint $LINT_PKGS # lint - ignore failures for now
30+
- diff -u <(echo -n) <(gofmt -d ./) # Fail if a .go file hasn't been formatted with gofmt
31+
- goverage -v -race -covermode=atomic -coverprofile=coverage.txt $PKGS # Run all tests with coverage
32+
- go vet -v ./... # static analyisis
33+
- golint $LINT_PKGS # lint - ignore failures for now
3434

3535
after_success:
3636
- bash <(curl -s https://codecov.io/bash)

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ Windows developers may have trouble producing a zip file that marks the binary a
5454

5555
Get the tool
5656
``` shell
57+
set GO111MODULE=on
5758
go.exe get -u github.com/aws/aws-lambda-go/cmd/build-lambda-zip
5859
```
5960

cmd/build-lambda-zip/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func main() {
1616
app.Name = "build-lambda-zip"
1717
app.Usage = "Put an executable and supplemental files into a zip file that works with AWS Lambda."
1818
app.Flags = []cli.Flag{
19-
cli.StringFlag{
19+
&cli.StringFlag{
2020
Name: "output, o",
2121
Value: "",
2222
Usage: "output file path for the zip. Defaults to the first input file name.",

events/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ This package provides input types for Lambda functions that process AWS events.
1414

1515
[CloudFormation Events](../cfn/README.md)
1616

17+
[CloudWatch Events](README_CloudWatch_Events.md)
18+
19+
[CloudWatch Logs](README_CloudWatch_Logs.md)
20+
1721
[Chime Bot Events](README_Chime_Bots.md)
1822

1923
[Code Commit Events](README_CodeCommit.md)

events/README_CloudWatch_Events.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
# Sample Function
3+
4+
The following is a Lambda function that receives Amazon CloudWatch event record data as input and writes event detail to Lambda's CloudWatch Logs. Note that by default anything written to Console will be logged as CloudWatch Logs events.
5+
6+
```go
7+
import (
8+
"context"
9+
"fmt"
10+
11+
"github.com/aws/aws-lambda-go/events"
12+
)
13+
14+
func handler(ctx context.Context, event events.CloudWatchEvent) {
15+
fmt.Printf("Detail = %s\n", event.Detail)
16+
}
17+
```

events/README_CloudWatch_Logs.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# Sample Function
3+
4+
The following is a Lambda function that receives Amazon CloudWatch Logs event record data as input and writes message part to Lambda's CloudWatch Logs. Note that by default anything written to Console will be logged as CloudWatch Logs events.
5+
6+
```go
7+
import (
8+
"context"
9+
"fmt"
10+
11+
"github.com/aws/aws-lambda-go/events"
12+
)
13+
14+
func handler(ctx context.Context, logsEvent events.CloudwatchLogsEvent) {
15+
data, _ := logsEvent.AWSLogs.Parse()
16+
for _, logEvent := range data.LogEvents {
17+
fmt.Printf("Message = %s\n", logEvent.Message)
18+
}
19+
}
20+
```

events/apigw.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ type APIGatewayCustomAuthorizerPolicy struct {
168168
Statement []IAMPolicyStatement
169169
}
170170

171+
// IAMPolicyStatement represents one statement from IAM policy with action, effect and resource
171172
type IAMPolicyStatement struct {
172173
Action []string
173174
Effect string

events/attributevalue.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ func (av DynamoDBAttributeValue) Number() string {
7575
// of an int64 of the appropriate sign.
7676
// Method panics if the attribute is not of type Number.
7777
func (av DynamoDBAttributeValue) Integer() (int64, error) {
78-
s, err := strconv.ParseFloat(av.Number(), 64)
78+
number := av.Number()
79+
value, err := strconv.ParseInt(number, 10, 64)
80+
if err == nil {
81+
return value, nil
82+
}
83+
s, err := strconv.ParseFloat(number, 64)
7984
return int64(s), err
8085
}
8186

events/attributevalue_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ func TestAccessWithWrongTypePanics(t *testing.T) {
211211
}
212212

213213
for _, testCase := range testCases {
214+
testCase := testCase
214215
var av DynamoDBAttributeValue
215216
err := json.Unmarshal([]byte(testCase.input), &av)
216217
assert.Nil(t, err)

events/chime_bot_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ package events
44
import (
55
"encoding/json"
66
"testing"
7+
"time"
78

89
"github.com/aws/aws-lambda-go/events/test"
910
"github.com/stretchr/testify/assert"
10-
"time"
1111
)
1212

1313
func TestChimeBotEventMarshaling(t *testing.T) {
@@ -116,6 +116,7 @@ func TestChimeBotEventMarshaling(t *testing.T) {
116116
}
117117

118118
for name, test := range tests {
119+
test := test
119120
t.Run(name, func(t *testing.T) {
120121
var testEvent ChimeBotEvent
121122
if err := json.Unmarshal([]byte(test.inputJSON), &testEvent); err != nil {

0 commit comments

Comments
 (0)