Skip to content

Commit 466dad2

Browse files
authored
Merge branch 'master' into update#186
2 parents 1ee63f4 + e5086e5 commit 466dad2

File tree

6 files changed

+39
-23
lines changed

6 files changed

+39
-23
lines changed

events/attributevalue.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ type DynamoDBAttributeValue struct {
1818
dataType DynamoDBDataType
1919
}
2020

21+
// This struct represents DynamoDBAttributeValue which doesn't
22+
// implement fmt.Stringer interface and safely `fmt.Sprintf`able
23+
type dynamoDbAttributeValue DynamoDBAttributeValue
24+
2125
// Binary provides access to an attribute of type Binary.
2226
// Method panics if the attribute is not of type Binary.
2327
func (av DynamoDBAttributeValue) Binary() []byte {
@@ -97,8 +101,13 @@ func (av DynamoDBAttributeValue) NumberSet() []string {
97101
// String provides access to an attribute of type String.
98102
// Method panics if the attribute is not of type String.
99103
func (av DynamoDBAttributeValue) String() string {
100-
av.ensureType(DataTypeString)
101-
return av.value.(string)
104+
if av.dataType == DataTypeString {
105+
return av.value.(string)
106+
}
107+
// If dataType is not DataTypeString during fmt.Sprintf("%#v", ...)
108+
// compiler confuses with fmt.Stringer interface and panics
109+
// instead of printing the struct.
110+
return fmt.Sprintf("%v", dynamoDbAttributeValue(av))
102111
}
103112

104113
// StringSet provides access to an attribute of type String Set.

events/duration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
type DurationSeconds time.Duration
1010

1111
func (duration *DurationSeconds) UnmarshalJSON(data []byte) error {
12-
var seconds int64
12+
var seconds float64
1313
if err := json.Unmarshal(data, &seconds); err != nil {
1414
return err
1515
}
@@ -26,7 +26,7 @@ func (duration DurationSeconds) MarshalJSON() ([]byte, error) {
2626
type DurationMinutes time.Duration
2727

2828
func (duration *DurationMinutes) UnmarshalJSON(data []byte) error {
29-
var minutes int64
29+
var minutes float64
3030
if err := json.Unmarshal(data, &minutes); err != nil {
3131
return err
3232
}

events/testdata/codebuild-phase-change.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"type": "LINUX_CONTAINER",
2828
"environment-variables": []
2929
},
30-
"timeout-in-minutes": 60,
30+
"timeout-in-minutes": 60.0,
3131
"build-complete": true,
3232
"initiator": "MyCodeBuildDemoUser",
3333
"build-start-time": "Sep 1, 2017 4:12:29 PM",
@@ -45,7 +45,7 @@
4545
"phase-context": [],
4646
"start-time": "Sep 1, 2017 4:12:29 PM",
4747
"end-time": "Sep 1, 2017 4:12:29 PM",
48-
"duration-in-seconds": 0,
48+
"duration-in-seconds": 0.0,
4949
"phase-type": "SUBMITTED",
5050
"phase-status": "SUCCEEDED"
5151
},
@@ -61,7 +61,7 @@
6161
"phase-context": [],
6262
"start-time": "Sep 1, 2017 4:13:05 PM",
6363
"end-time": "Sep 1, 2017 4:13:10 PM",
64-
"duration-in-seconds": 4,
64+
"duration-in-seconds": 4.0,
6565
"phase-type": "DOWNLOAD_SOURCE",
6666
"phase-status": "SUCCEEDED"
6767
},
@@ -77,7 +77,7 @@
7777
"phase-context": [],
7878
"start-time": "Sep 1, 2017 4:13:10 PM",
7979
"end-time": "Sep 1, 2017 4:13:10 PM",
80-
"duration-in-seconds": 0,
80+
"duration-in-seconds": 0.0,
8181
"phase-type": "PRE_BUILD",
8282
"phase-status": "SUCCEEDED"
8383
},
@@ -93,7 +93,7 @@
9393
"phase-context": [],
9494
"start-time": "Sep 1, 2017 4:14:21 PM",
9595
"end-time": "Sep 1, 2017 4:14:21 PM",
96-
"duration-in-seconds": 0,
96+
"duration-in-seconds": 0.0,
9797
"phase-type": "POST_BUILD",
9898
"phase-status": "SUCCEEDED"
9999
},
@@ -109,7 +109,7 @@
109109
"phase-context": [],
110110
"start-time": "Sep 1, 2017 4:14:21 PM",
111111
"end-time": "Sep 1, 2017 4:14:26 PM",
112-
"duration-in-seconds": 4,
112+
"duration-in-seconds": 4.0,
113113
"phase-type": "FINALIZING",
114114
"phase-status": "SUCCEEDED"
115115
},
@@ -120,9 +120,9 @@
120120
]
121121
},
122122
"completed-phase-status": "SUCCEEDED",
123-
"completed-phase-duration-seconds": 4,
123+
"completed-phase-duration-seconds": 4.0,
124124
"version": "1",
125125
"completed-phase-start": "Sep 1, 2017 4:14:21 PM",
126126
"completed-phase-end": "Sep 1, 2017 4:14:26 PM"
127127
}
128-
}
128+
}

events/testdata/codebuild-state-change.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
}
3333
]
3434
},
35-
"timeout-in-minutes": 60,
35+
"timeout-in-minutes": 60.0,
3636
"build-complete": true,
3737
"initiator": "MyCodeBuildDemoUser",
3838
"build-start-time": "Sep 1, 2017 4:12:29 PM",
@@ -58,7 +58,7 @@
5858
"phase-context": [],
5959
"start-time": "Sep 1, 2017 4:12:29 PM",
6060
"end-time": "Sep 1, 2017 4:13:05 PM",
61-
"duration-in-seconds": 36,
61+
"duration-in-seconds": 36.0,
6262
"phase-type": "PROVISIONING",
6363
"phase-status": "SUCCEEDED"
6464
},
@@ -74,7 +74,7 @@
7474
"phase-context": [],
7575
"start-time": "Sep 1, 2017 4:13:10 PM",
7676
"end-time": "Sep 1, 2017 4:13:10 PM",
77-
"duration-in-seconds": 0,
77+
"duration-in-seconds": 0.0,
7878
"phase-type": "INSTALL",
7979
"phase-status": "SUCCEEDED"
8080
},
@@ -90,7 +90,7 @@
9090
"phase-context": [],
9191
"start-time": "Sep 1, 2017 4:13:10 PM",
9292
"end-time": "Sep 1, 2017 4:14:21 PM",
93-
"duration-in-seconds": 70,
93+
"duration-in-seconds": 70.0,
9494
"phase-type": "BUILD",
9595
"phase-status": "SUCCEEDED"
9696
},
@@ -106,7 +106,7 @@
106106
"phase-context": [],
107107
"start-time": "Sep 1, 2017 4:14:21 PM",
108108
"end-time": "Sep 1, 2017 4:14:21 PM",
109-
"duration-in-seconds": 0,
109+
"duration-in-seconds": 0.0,
110110
"phase-type": "UPLOAD_ARTIFACTS",
111111
"phase-status": "SUCCEEDED"
112112
},

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module github.com/aws/aws-lambda-go
33
go 1.12
44

55
require (
6-
github.com/stretchr/testify v1.3.0
7-
github.com/urfave/cli v1.21.0
6+
github.com/stretchr/testify v1.4.0
7+
github.com/urfave/cli v1.22.1
88
)

go.sum

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
2+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY=
3+
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
24
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
35
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
46
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
57
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
8+
github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q=
9+
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
10+
github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo=
11+
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
612
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7-
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
8-
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
9-
github.com/urfave/cli v1.21.0 h1:wYSSj06510qPIzGSua9ZqsncMmWE3Zr55KBERygyrxE=
10-
github.com/urfave/cli v1.21.0/go.mod h1:lxDj6qX9Q6lWQxIrbrT0nwecwUtRnhVZAJjJZrVUZZQ=
13+
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
14+
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
15+
github.com/urfave/cli v1.22.1 h1:+mkCCcOFKPnCmVYVcURKps1Xe+3zP90gSYGNfRkjoIY=
16+
github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0=
1117
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
18+
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
1219
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

0 commit comments

Comments
 (0)