I've come across a bug and thought I'd create an issue in case anyone else hits it.
mock.ExpectPutItem().ToTable(test_table).WithItems(map[string]*dynamodb.AttributeValue{
"Provider": {S: aws.String("aws")},
"ETag": {S: aws.String(`W/"3fd5cf340c5e30202eca209855b7544a"`)},
"Version": {S: aws.String(`v3.7.0`)},
}).WillReturns(dynamodb.PutItemOutput{
Attributes: map[string]*dynamodb.AttributeValue{
"Provider": {S: aws.String("aws")},
"ETag": {S: aws.String(`W/"3fd5cf340c5e30202eca209855b7544a"`)},
"Version": {S: aws.String(`v3.7.0`)},
},
})
I get:
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1579ecd]
goroutine 22 [running]:
testing.tRunner.func1.1(0x1645200, 0x1d9ddb0)
/usr/local/go/src/testing/testing.go:940 +0x2f5
testing.tRunner.func1(0xc000263320)
/usr/local/go/src/testing/testing.go:943 +0x3f9
panic(0x1645200, 0x1d9ddb0)
/usr/local/go/src/runtime/panic.go:969 +0x166
github.com/gusaul/go-dynamock.(*MockDynamoDB).PutItem(0xc0000b3a40, 0xc0000ccbe0, 0x16eadc0, 0x7, 0xc0002d10d8)
/Users/nick/go/pkg/mod/github.com/gusaul/go-dynamock@v0.0.0-20200325102056-aaeeb0c0e9c1/put_item.go:36 +0x7d
data_processing.(*ProviderFeedService).CheckForNewVersions(0xc00010ff30, 0x16e7f84, 0x3, 0x1710696, 0x4b, 0x0, 0x0, 0x0, 0x0, 0x0)
Running a debug, I see *input.Table is nil, so an error is never returned.

It appears I provided the wrong input, but expected a graceful error rather than a panic.
I've come across a bug and thought I'd create an issue in case anyone else hits it.
I get:
Running a debug, I see
*input.Tableis nil, so an error is never returned.It appears I provided the wrong input, but expected a graceful error rather than a panic.